QT C++ Basic GUI Video Tutorial
Posted Date Unknown 0 Comment


Developing Cross platform C++ application is always been a challenge in the past. But with the introduction of QT C++ , this was as easy as developing Visual Studio.NET application. But the lack of documentation and support makes it difficult to master some its concepts for a beginer.

In this Video Tutorial we will show you how to develop and Debug a QT C++ application. The video will also show you how to use the various toll sets provided by QT.

Watch the Video Tutorial From the Link Below..



Main Code

MainWindow.h


#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QByteArray>
//#include <SoundTouch.h>
#include <qaudioinput.h>
#include<qaudiooutput.h>
#include <QBuffer>

namespace Ui {
    class MainWindow;
}


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    void initializeAudio();
    void createAudioInput();
    void createAudioOutput();

    int ApplyVolumeToSample(short iSample);

private slots:
    void readMore();
    void on_pushButton_clicked();
    void on_horizontalSlider_valueChanged(int value);

private:
    Ui::MainWindow *ui;
    QAudioDeviceInfo m_Inputdevice;
    QAudioDeviceInfo m_Outputdevice;
    QAudioFormat m_format;
    QAudioInput *m_audioInput;
    QAudioOutput *m_audioOutput;
    QIODevice *m_input;
    QIODevice *m_output;
    QByteArray m_buffer;
    int m_iVolume;

};

#endif // MAINWINDOW_H



MainWindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::on_pushButtonCalculate_clicked()
{
    QString Data1= ui->textEdit1->toPlainText();
    QString Data2= ui->textEdit2->toPlainText();
    int iResult=atoi(Data1.toAscii())+atoi(Data2.toAscii());

    QString Result;
    Result.sprintf("%d",iResult);
    ui->textEditResult->setText(Result);

}
 

#include <QtGui/QApplication>
#include "mainwindow.h"

Main.cpp

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

See All Responses Below...
Author
Message Rating
Posted on:
Please Login to Post Your Comments
Name (Max. 100 characters)
Please post your comments here
Select Language
Comments
Attach File(Max. Size: 2 MB)
A few simple rules when posting your Comments,
  1. Please post only answers relevant to the topic of discussion.
  2. Please dont misuse this site or do not be abusive, offensive, inappropriate,harass anyone on the boards or post ads or spam. Doing so will delete your inappropriate messages and will block or delete your account on this site. 

TekTipsDownload
GateExam
Academic Projects
TekTipsExperts



 
Site optimized for IE7, 1280 X 768 and above. Copyright © 2010 - 2018 KTS InfoTech
Site Developed Using KTS WebCloud