-
Notifications
You must be signed in to change notification settings - Fork 2
/
dialog.hpp
62 lines (47 loc) · 1.16 KB
/
dialog.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef DIALOG_HPP
#define DIALOG_HPP
#include "commonwidget.hpp"
#include <QDialog>
namespace GUI {
#ifndef Q_OS_MACOS
class GUI_EXPORT Dialog : public CommonWidget
{
Q_OBJECT
public:
enum ExecFlags { Accepted, Rejected, Close };
explicit Dialog(QWidget *parent = nullptr);
~Dialog() override;
auto exec() -> int;
signals:
void accepted();
void rejected();
public slots:
void accept();
void reject();
private slots:
void onClosed();
private:
void buildConnect();
class DialogPrivate;
QScopedPointer<DialogPrivate> d_ptr;
};
#else
class GUI_EXPORT Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = nullptr)
: QDialog(parent)
{
setWindowFlags((windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint);
}
void setMinButtonVisible(bool) {}
void setRestoreMaxButtonVisible(bool) {}
void setIcon(const QIcon &icon) { setWindowIcon(icon); }
void setTitle(const QString &title) { setWindowTitle(title); }
void setCentralWidget(QWidget *widget);
int shadowPadding() { return 0; }
};
#endif
} // namespace GUI
#endif // DIALOG_HPP