QT C++ GUI Programming Video Tutorials Simple Interest Example
Rate this article
0 out of 5

Developing Good user friendly Graphical user Interface is always a challenging task. Worse will be the case if the user interface wants to be cross platform. With the introduction of QT C++ libraries , this job is now as easy as developing a single source base and compiling it on multiple platforms. In this video tutorial, we will show you how to develop a basic QT C++ GUI application Video tutorial using an example Simple Interest.

Watch the YouTube Video from the link below ..




Main Source Code

SimpleInterest.h

#ifndef SIMPLEINTEREST_H
#define SIMPLEINTEREST_H

#include <QMainWindow>

namespace Ui {
    class SimpleInterest;
}

class SimpleInterest : public QMainWindow {
    Q_OBJECT
public:
    SimpleInterest(QWidget *parent = 0);
    ~SimpleInterest();

protected:
    void changeEvent(QEvent *e);
    void Calculate();

private:
    Ui::SimpleInterest *ui;

private slots:
    void on_pushButton_clicked();
    void on_pushButton_clicked(bool checked);
};

#endif // SIMPLEINTEREST_H

simpleinterest.cpp

#include "simpleinterest.h"
#include "ui_simpleinterest.h"
#include <QApplication>
#include "qbytearray.h"
#include <QString>

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

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

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



void SimpleInterest::on_pushButton_clicked()
{

Calculate();


}
void SimpleInterest::Calculate()
{
    QString Amount=ui->textAmount->toPlainText();
        QString NoofMonths=ui->textMonths->toPlainText();
        QString Interest=ui->textInterest->toPlainText();
        double InterestRate=(Amount.toDouble())+(Amount.toDouble()*NoofMonths.toDouble()*Interest.toDouble()/100);
        QString Result;
            Result.sprintf("%f",InterestRate);
            ui->textResult->setText(Result);


}

main.cpp

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

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    SimpleInterest w;
    w.show();
    return a.exec();
}






Download Source Code

About The Author
KTS Training

KTS InfoTech Training division offers various short-term programming courses for Students and Professionals who are looking for a bright career in the field of Software development.

The programming video tutorials presented in this web site are taken from some of the training sessions conducted by KTS InfoTech.

You can also learn the Programming packages through Internet directly form our English Speaking Technical experts at an affordable rate.

For more details click here and submit your training requirements.



Number Of articles Posted      : 60
Number Of Messages Posted  : 3
Joined Date : 2012/11/14
   
Author
Messages
Posted:
Post Your Comments  
Name (Max 50 Chars)
Comments
 
 

 
TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android