3#include "qml_material/control/popup.hpp"
4#include "qml_material/control/page.hpp"
5#include "qml_material/control/dialog_button_box.hpp"
9class QML_MATERIAL_API Dialog :
public Popup {
11 QML_NAMED_ELEMENT(DialogBase)
12 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
13 Q_PROPERTY(QQuickItem* header READ header WRITE setHeader NOTIFY headerChanged FINAL)
14 Q_PROPERTY(QQuickItem* footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
16 qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL)
17 Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY
18 implicitHeaderHeightChanged FINAL)
20 qreal implicitFooterWidth READ implicitFooterWidth NOTIFY implicitFooterWidthChanged FINAL)
21 Q_PROPERTY(qreal implicitFooterHeight READ implicitFooterHeight NOTIFY
22 implicitFooterHeightChanged FINAL)
23 Q_PROPERTY(
int result READ result WRITE setResult NOTIFY resultChanged FINAL)
24 Q_PROPERTY(
bool acceptEnabled READ acceptEnabled WRITE setAcceptEnabled NOTIFY
25 acceptEnabledChanged FINAL)
26 Q_PROPERTY(
int standardButtons READ standardButtons WRITE setStandardButtons NOTIFY
27 standardButtonsChanged FINAL)
37 NoButton = DialogButtonBox::NoButton,
38 Ok = DialogButtonBox::Ok,
39 Save = DialogButtonBox::Save,
40 SaveAll = DialogButtonBox::SaveAll,
41 Open = DialogButtonBox::Open,
42 Yes = DialogButtonBox::Yes,
43 YesToAll = DialogButtonBox::YesToAll,
44 No = DialogButtonBox::No,
45 NoToAll = DialogButtonBox::NoToAll,
46 Abort = DialogButtonBox::Abort,
47 Retry = DialogButtonBox::Retry,
48 Ignore = DialogButtonBox::Ignore,
49 Close = DialogButtonBox::Close,
50 Cancel = DialogButtonBox::Cancel,
51 Discard = DialogButtonBox::Discard,
52 Help = DialogButtonBox::Help,
53 Apply = DialogButtonBox::Apply,
54 Reset = DialogButtonBox::Reset,
55 RestoreDefaults = DialogButtonBox::RestoreDefaults
57 Q_ENUM(StandardButton)
58 explicit Dialog(QObject* parent =
nullptr);
60 QString title()
const {
return page()->title(); }
61 void setTitle(QString value) { page()->setTitle(value); }
62 Q_SIGNAL
void titleChanged();
63 QQuickItem* header()
const {
return page()->header(); }
64 void setHeader(QQuickItem* value) { page()->setHeader(value); }
65 Q_SIGNAL
void headerChanged();
66 QQuickItem* footer()
const {
return page()->footer(); }
67 void setFooter(QQuickItem* value) { page()->setFooter(value); }
68 Q_SIGNAL
void footerChanged();
69 qreal implicitHeaderWidth()
const {
return page()->implicitHeaderWidth(); }
70 Q_SIGNAL
void implicitHeaderWidthChanged();
71 qreal implicitHeaderHeight()
const {
return page()->implicitHeaderHeight(); }
72 Q_SIGNAL
void implicitHeaderHeightChanged();
73 qreal implicitFooterWidth()
const {
return page()->implicitFooterWidth(); }
74 Q_SIGNAL
void implicitFooterWidthChanged();
75 qreal implicitFooterHeight()
const {
return page()->implicitFooterHeight(); }
76 Q_SIGNAL
void implicitFooterHeightChanged();
77 int result()
const {
return m_result; }
79 bool acceptEnabled()
const {
return m_acceptEnabled; }
80 void setAcceptEnabled(
bool value);
81 Q_SIGNAL
void acceptEnabledChanged();
82 int standardButtons()
const {
return m_standardButtons; }
83 void setStandardButtons(
int);
84 Q_INVOKABLE AbstractButton* standardButton(
int)
const;
85 Q_INVOKABLE
void accept();
86 Q_INVOKABLE
void reject();
87 Q_INVOKABLE
void done(
int);
88 void closeFromInput()
override;
89 Q_SIGNAL
void resultChanged();
90 Q_SIGNAL
void standardButtonsChanged();
91 Q_SIGNAL
void accepted();
92 Q_SIGNAL
void rejected();
93 Q_SIGNAL
void applied();
94 Q_SIGNAL
void reset();
95 Q_SIGNAL
void discarded();
96 Q_SIGNAL
void helpRequested();
99 Page* page()
const {
return static_cast<Page*
>(surfaceItem()); }
100 void syncButtonBoxes();
101 QList<QMetaObject::Connection> m_buttonConnections;
102 quint64 m_buttonRevision = 0;
103 bool m_acceptEnabled =
true;
104 int m_result = Rejected;
105 int m_standardButtons = NoButton;