(C++) makefile of a Qt Creator GUI application

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) makefile of a Qt Creator GUI application

 

Operating system: Ubuntu 10.04 LTS Lucid Lynx

IDE: Qt Creator 2.0.0

Project type: GUI application

Compiler: G++ 4.4.1

Libraries used:

  • Qt: version 4.7.0 (32 bit)

 

 

 

 

 

Qt project file

 


#------------------------------------------------- # # Project created by QtCreator 2010-09-23T21:40:55 # #------------------------------------------------- QT       += core gui TARGET = CppMakeGui TEMPLATE = app SOURCES += main.cpp\         dialog.cpp HEADERS  += dialog.h FORMS    += dialog.ui

 

 

 

 

 

dialog.cpp

 


#include "dialog.h" #include "ui_dialog.h" Dialog::Dialog(QWidget *parent) :     QDialog(parent),     ui(new Ui::Dialog) {     ui->setupUi(this); } Dialog::~Dialog() {     delete ui; } void Dialog::changeEvent(QEvent *e) {     QDialog::changeEvent(e);     switch (e->type()) {     case QEvent::LanguageChange:         ui->retranslateUi(this);         break;     default:         break;     } }

 

 

 

 

 

dialog.h

 


#ifndef DIALOG_H #define DIALOG_H #include <QDialog> namespace Ui {     class Dialog; } class Dialog : public QDialog {     Q_OBJECT public:     explicit Dialog(QWidget *parent = 0);     ~Dialog(); protected:     void changeEvent(QEvent *e); private:     Ui::Dialog *ui; }; #endif // DIALOG_H

 

 

 

 

 

main.cpp

 


#include <QtGui/QApplication> #include "dialog.h" int main(int argc, char *argv[]) {     QApplication a(argc, argv);     Dialog w;     w.show();     return a.exec(); }