How to Develop and Debug a QT C++ Application
Rate this article
5.00 out of 5

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();
}


Download sourec code
Download QT C++ 4.6 Source code from the Link below.

Author :
Tom Thomas
Joined Date :12-Aug-2011
Articles
Posted
9
Messages
Posted
207
Mr. Tom is the Co-Founder and CTO of  KTS InfoTech.  He started his career as a C/C++ programmer in the late 90's and has been very active and passionate in programming since then. He had worked both in start-ups ( Infortech software Pvt Ltd) as well as in CMM Level 5 companies (NeST and Wipro Technologies) for clients like General Electric, Agilent, Hitachi, Toshiba, Fujitsu, Alcatel, Insurance Service Corporation etc. His experience as an Engineer, Architect, Project Manager, Chief Technical Officer and as a Teacher makes him ideal for any type of jobs related to Information Technology.

His role with his present employer includes exploring new business opportunities and partnerships, Developing software product frameworks, developing and executing marketing strategies for company products etc.  

He holds Masters degree in Physics and Computer Science form CUSAT , one of the premier Science and Technology Institutions in India .

His major interests are in Optical Networking, Robotics, Device drivers, Database, Graphics, web applications, Software product Engineering, Open source Technologies and Sports physics.

He resides in Kerala ,India, with his mother, wife and his little angel.

He can be reached on Skype at this ID thomas_tom99 or at his E Mail address tom.thomas (at)ktsinfotech.com

         

   
Messages
Posted:
Post Your Comments
Name (Max 50 Chars)
Comments
   Design  HTML

TekTipsDownload
GateExam
Academic Projects
TekTipsExperts



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