From dbe8eef5f5c500758dd3ddafe9e6f94771d7fd97 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 13 Sep 2015 18:43:00 +0100 Subject: qt-test: add a header Test moc tool --- src/qt-test.cpp | 7 +++---- src/qt-test.hpp | 30 ++++++++++++++++++++++++++++++ src/qt-test.pro | 1 + 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 src/qt-test.hpp diff --git a/src/qt-test.cpp b/src/qt-test.cpp index 83a1cb3..20794cf 100644 --- a/src/qt-test.cpp +++ b/src/qt-test.cpp @@ -4,14 +4,13 @@ */ #include -#include "ui_qt-test.h" + +#include "qt-test.hpp" int main(int argc, char *argv[]) { QApplication a(argc, argv); - QMainWindow w; - Ui::MainWindow u; - u.setupUi(&w); + MainWindow w; w.show(); a.aboutQt(); return a.exec(); diff --git a/src/qt-test.hpp b/src/qt-test.hpp new file mode 100644 index 0000000..213f59b --- /dev/null +++ b/src/qt-test.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include "ui_qt-test.h" + +class MainWindow : public QMainWindow { + Q_OBJECT +public: + MainWindow(QWidget* parent = 0): + QMainWindow(parent), + ui(new Ui::MainWindow) + { + ui->setupUi(this); + } + + ~MainWindow() { + delete ui; + } + +signals: + void testSignal(); + +public slots: + void testSlot() { + } + +private: + Ui::MainWindow* ui; +}; diff --git a/src/qt-test.pro b/src/qt-test.pro index 5d323dc..fd4f55b 100644 --- a/src/qt-test.pro +++ b/src/qt-test.pro @@ -5,6 +5,7 @@ greaterThan(QT_MAJOR_VERSION, 4): TARGET = test-qt5 else: TARGET = test-qt QT += network sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +HEADERS += qt-test.hpp SOURCES += qt-test.cpp FORMS += qt-test.ui RESOURCES += qt-test.qrc -- cgit v0.12