Created
August 21, 2019 08:57
-
-
Save haxpor/7764eb45c4597542cfe61a4eecc02d2b to your computer and use it in GitHub Desktop.
Boiler-plate code for QDialog, QMainWindow, and QWidget. Based on Qt 5.13.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Dialog.h" | |
#include "ui_Dialog.h" | |
Dialog::Dialog(QWidget *parent) : | |
QDialog(parent), | |
ui(new Ui::Dialog) | |
{ | |
ui->setupUi(this); | |
} | |
Dialog::~Dialog() | |
{ | |
delete ui; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DIALOG_H | |
#define DIALOG_H | |
#include <QDialog> | |
namespace Ui { | |
class Dialog; | |
} | |
class Dialog : public QDialog | |
{ | |
Q_OBJECT | |
public: | |
explicit Dialog(QWidget *parent = nullptr); | |
~Dialog(); | |
private: | |
Ui::Dialog *ui; | |
}; | |
#endif // DIALOG_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mainwindow.h" | |
#include "ui_mainwindow.h" | |
MainWindow::MainWindow(QWidget *parent) : | |
QMainWindow(parent), | |
ui(new Ui::MainWindow) | |
{ | |
ui->setupUi(this); | |
} | |
MainWindow::~MainWindow() | |
{ | |
delete ui; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MAINWINDOW_H | |
#define MAINWINDOW_H | |
#include <QMainWindow> | |
namespace Ui { | |
class MainWindow; | |
} | |
class MainWindow : public QMainWindow | |
{ | |
Q_OBJECT | |
public: | |
explicit MainWindow(QWidget *parent = nullptr); | |
~MainWindow(); | |
private: | |
Ui::MainWindow *ui; | |
}; | |
#endif // MAINWINDOW_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Widget.h" | |
#include "ui_Widget.h" | |
Widget::Widget(QWidget *parent) : | |
QWidget(parent), | |
ui(new Ui::Widget) | |
{ | |
ui->setupUi(this); | |
} | |
Widget::~Widget() | |
{ | |
delete ui; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef WIDGET_H | |
#define WIDGET_H | |
#include <QWidget> | |
namespace Ui { | |
class Widget; | |
} | |
class Widget : public QWidget | |
{ | |
Q_OBJECT | |
public: | |
explicit Widget(QWidget *parent = nullptr); | |
~Widget(); | |
private: | |
Ui::Widget *ui; | |
}; | |
#endif // WIDGET_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment