QT C++ GUI Video Tutorials Simple Interest Example

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





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
Android