Skip to content

Instantly share code, notes, and snippets.

@HaiyongJiang
Forked from gongzhitaao/CMakeLists.txt
Last active February 17, 2018 13:56
Show Gist options
  • Save HaiyongJiang/0fb65bdb6a23f04acd44 to your computer and use it in GitHub Desktop.
Save HaiyongJiang/0fb65bdb6a23f04acd44 to your computer and use it in GitHub Desktop.
# suppose you have created a ui file called configwin.ui
cmake_minimum_required (VERSION 2.6)
project(tst)
find_package(Qt5Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
QT5_WRAP_CPP(tst_hdr_moc configwin.h)
QT5_WRAP_UI(tst_form_hdr configwin.ui)
add_library(configwin ${tst_hdr_moc} ${tst_form_hdr})
qt5_use_modules(configwin Widgets)
add_executable(tst setting.cpp configwin)
qt5_use_modules(tst Core Gui Widgets)
#include "configwin.h"
ConfigWin::ConfigWin(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConfigWin)
{
ui->setupUi(this);
}
ConfigWin::~ConfigWin()
{
delete ui;
}
#ifndef CONFIGWIN_H
#define CONFIGWIN_H
#include "ui_configwin.h"
namespace Ui {
class ConfigWin;
}
class ConfigWin : public QDialog
{
Q_OBJECT
public:
explicit ConfigWin(QWidget *parent = 0);
~ConfigWin();
private:
Ui::ConfigWin *ui;
};
#endif // CONFIGWIN_H
#include <QApplication>
#include "configwin.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ConfigWin w;
w.show();
return a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment