Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdialogbuttonbox.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QDIALOGBUTTONBOX_H
6#define QDIALOGBUTTONBOX_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtWidgets/qwidget.h>
10
12
13QT_BEGIN_NAMESPACE
14
15
16class QAbstractButton;
17class QPushButton;
18class QDialogButtonBoxPrivate;
19
20class Q_WIDGETS_EXPORT QDialogButtonBox : public QWidget
21{
22 Q_OBJECT
23 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
24 Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
25 Q_PROPERTY(bool centerButtons READ centerButtons WRITE setCenterButtons)
26
27public:
28 enum ButtonRole {
29 // keep this in sync with QMessageBox::ButtonRole and QPlatformDialogHelper::ButtonRole
30 InvalidRole = -1,
31 AcceptRole,
32 RejectRole,
33 DestructiveRole,
34 ActionRole,
35 HelpRole,
36 YesRole,
37 NoRole,
38 ResetRole,
39 ApplyRole,
40
41 NRoles
42 };
43
44 enum StandardButton {
45 // keep this in sync with QMessageBox::StandardButton and QPlatformDialogHelper::StandardButton
46 NoButton = 0x00000000,
47 Ok = 0x00000400,
48 Save = 0x00000800,
49 SaveAll = 0x00001000,
50 Open = 0x00002000,
51 Yes = 0x00004000,
52 YesToAll = 0x00008000,
53 No = 0x00010000,
54 NoToAll = 0x00020000,
55 Abort = 0x00040000,
56 Retry = 0x00080000,
57 Ignore = 0x00100000,
58 Close = 0x00200000,
59 Cancel = 0x00400000,
60 Discard = 0x00800000,
61 Help = 0x01000000,
62 Apply = 0x02000000,
63 Reset = 0x04000000,
64 RestoreDefaults = 0x08000000,
65
66#ifndef Q_MOC_RUN
67 FirstButton = Ok,
68 LastButton = RestoreDefaults
69#endif
70 };
71
72 Q_DECLARE_FLAGS(StandardButtons, StandardButton)
73 Q_FLAG(StandardButtons)
74
75 enum ButtonLayout {
76 // keep this in sync with QPlatformDialogHelper::ButtonLayout
77 WinLayout,
78 MacLayout,
79 KdeLayout,
80 GnomeLayout,
81 AndroidLayout
82 };
83
84 QDialogButtonBox(QWidget *parent = nullptr);
85 QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = nullptr);
86 explicit QDialogButtonBox(StandardButtons buttons, QWidget *parent = nullptr);
87 QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation,
88 QWidget *parent = nullptr);
89 ~QDialogButtonBox();
90
91 void setOrientation(Qt::Orientation orientation);
92 Qt::Orientation orientation() const;
93
94 void addButton(QAbstractButton *button, ButtonRole role);
95 QPushButton *addButton(const QString &text, ButtonRole role);
96 QPushButton *addButton(StandardButton button);
97 void removeButton(QAbstractButton *button);
98 void clear();
99
100 QList<QAbstractButton *> buttons() const;
101 ButtonRole buttonRole(QAbstractButton *button) const;
102
103 void setStandardButtons(StandardButtons buttons);
104 StandardButtons standardButtons() const;
105 StandardButton standardButton(QAbstractButton *button) const;
106 QPushButton *button(StandardButton which) const;
107
108 void setCenterButtons(bool center);
109 bool centerButtons() const;
110
111Q_SIGNALS:
112 void clicked(QAbstractButton *button);
113 void accepted();
114 void helpRequested();
115 void rejected();
116
117protected:
118 void changeEvent(QEvent *event) override;
119 bool event(QEvent *event) override;
120
121private:
122 Q_DISABLE_COPY(QDialogButtonBox)
123 Q_DECLARE_PRIVATE(QDialogButtonBox)
124};
125
126Q_DECLARE_OPERATORS_FOR_FLAGS(QDialogButtonBox::StandardButtons)
127
128QT_END_NAMESPACE
129
130#endif // QDIALOGBUTTONBOX_H
The QDialogButtonBox class is a widget that presents buttons in a layout that is appropriate to the c...
void setPageLayout(const QPageLayout &layout)
void setPagePreviewLayout(int columns, int rows)
QPagePreview(QWidget *parent)
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void setPrinter(QPrinter *printer, QPrintDevice *printDevice, QPrinter::OutputFormat outputFormat, const QString &printerName)
QPainter(QPaintDevice *)
Constructs a painter that begins painting the paint device immediately.
friend class QWidget
Definition qpainter.h:431
int inputSlotIdToWindowsId(QPrint::InputSlotId id)
Definition qprint.cpp:61
ColorMode
Definition qprint_p.h:73
@ Color
Definition qprint_p.h:75
@ GrayScale
Definition qprint_p.h:74
DuplexMode
Definition qprint_p.h:65
@ DuplexLongSide
Definition qprint_p.h:68
@ DuplexShortSide
Definition qprint_p.h:69
@ DuplexNone
Definition qprint_p.h:66
@ DuplexAuto
Definition qprint_p.h:67
InputSlotId
Definition qprint_p.h:80
@ CustomInputSlot
Definition qprint_p.h:95
@ FormSource
Definition qprint_p.h:93
@ OnlyOne
Definition qprint_p.h:97
@ Envelope
Definition qprint_p.h:85
@ EnvelopeManual
Definition qprint_p.h:86
@ LargeCapacity
Definition qprint_p.h:91
@ LargeFormat
Definition qprint_p.h:90
@ Cassette
Definition qprint_p.h:92
@ Lower
Definition qprint_p.h:82
@ Upper
Definition qprint_p.h:81
@ Middle
Definition qprint_p.h:83
@ SmallFormat
Definition qprint_p.h:89
@ Tractor
Definition qprint_p.h:88
@ Auto
Definition qprint_p.h:87
@ LastInputSlot
Definition qprint_p.h:96
@ MaxPageSource
Definition qprint_p.h:94
@ Manual
Definition qprint_p.h:84
OutputBinId
Definition qprint_p.h:107
@ LowerBin
Definition qprint_p.h:110
@ LastOutputBin
Definition qprint_p.h:113
@ RearBin
Definition qprint_p.h:111
@ UpperBin
Definition qprint_p.h:109
@ CustomOutputBin
Definition qprint_p.h:112
@ AutoOutputBin
Definition qprint_p.h:108
DeviceState
Definition qprint_p.h:57
@ Idle
Definition qprint_p.h:58
@ Error
Definition qprint_p.h:61
@ Aborted
Definition qprint_p.h:60
@ Active
Definition qprint_p.h:59
QT_REQUIRE_CONFIG(printdialog)
QT_REQUIRE_CONFIG(animation)
QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
QT_REQUIRE_CONFIG(thread)
QPrint::InputSlotId id
Definition qprint_p.h:125
const char * key
Definition qprint_p.h:127
QPrint::OutputBinId id
Definition qprint_p.h:131
const char * key
Definition qprint_p.h:132
QPrint::InputSlotId id
Definition qprint_p.h:103
QByteArray key
Definition qprint_p.h:101
QPrint::OutputBinId id
Definition qprint_p.h:119
QByteArray key
Definition qprint_p.h:117