4#include <QtCore/qhash.h>
5#include <QtWidgets/qpushbutton.h>
6#include <QtWidgets/qstyle.h>
7#include <QtWidgets/qlayout.h>
8#include <QtWidgets/qdialog.h>
9#include <QtWidgets/qapplication.h>
10#include <private/qwidget_p.h>
11#include <private/qguiapplication_p.h>
12#include <QtGui/qpa/qplatformdialoghelper.h>
13#include <QtGui/qpa/qplatformtheme.h>
14#include <QtGui/qaction.h>
116 : orientation(orient), buttonLayout(
nullptr), center(
false)
127 if (createNewLayout) {
144 q->setSizePolicy(
sp);
158 int start = reverse ? buttonList.
size() - 1 : 0;
159 int end = reverse ? -1 : buttonList.
size();
160 int step = reverse ? -1 : 1;
172 const int MacGap = 36 - 8;
184 static const int M = 5;
188 bool hasModalButton =
false;
189 for (
int i = 0;
i <
M; ++
i) {
191 hasModalButton =
true;
226 if (acceptRoleList.
size() > 1)
358 qWarning(
"QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
361#if QT_CONFIG(shortcut)
363 if (!standardShortcut.
isEmpty())
386 switch (layoutRule) {
433 d_func()->initLayout();
459 d_func()->createStandardButtons(
buttons);
469 d->byPassEventFilter =
true;
603 return d_func()->orientation;
626 d->standardButtonHash.clear();
646 return d->allButtons();
738 qWarning(
"QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
757 qWarning(
"QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
775 return d->createButton(
button);
790 qDeleteAll(
d->standardButtonHash.keyBegin(),
d->standardButtonHash.keyEnd());
791 d->standardButtonHash.clear();
801 while (
it !=
d->standardButtonHash.constEnd()) {
817 return d->standardButtonHash.key(which);
858 emit q->helpRequested();
876 if (
d->byPassEventFilter)
935 if (
d->center != center) {
955 switch (
event->type()) {
957 if (!
d->standardButtonHash.empty()) {
959 const StandardButtonHash::iterator
end =
d->standardButtonHash.end();
960 for (StandardButtonHash::iterator
it =
d->standardButtonHash.begin();
it !=
end; ++
it)
961 it.key()->setStyle(newStyle);
982 : qobject_cast<QPushButton *>(acceptRoleList.
at(0));
984 if (!firstAcceptButton)
987 bool hasDefault =
false;
990 while (
p && !
p->isWindow()) {
991 p =
p->parentWidget();
992 if ((
dialog = qobject_cast<QDialog *>(
p)))
1006 if (!hasDefault && firstAcceptButton)
1014 for (
auto *
button : buttons)
1024 switch (
event->type()) {
1026 d->ensureFirstAcceptIsDefault();
1030 d->retranslateStrings();
1041#include "moc_qdialogbuttonbox.cpp"
static QStyle * style()
Returns the application's style object.
int count() const override
\reimp
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
QLayoutItem * takeAt(int) override
\reimp
void addSpacing(int size)
Adds a non-stretchable space (a QSpacerItem) with size size to the end of this box layout.
void addStretch(int stretch=0)
Adds a stretchable space (a QSpacerItem) with zero minimum size and stretch factor stretch to the end...
QLayoutItem * itemAt(int) const override
\reimp
Type
This enum type defines the valid event types in Qt.
static QPlatformTheme * platformTheme()
The QHBoxLayout class lines up widgets horizontally.
bool remove(const Key &key)
Removes the item that has the key from the hash.
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it.
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
bool isEmpty() const
Returns true if the key sequence is empty; otherwise returns false.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
void setContentsMargins(int left, int top, int right, int bottom)
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
QList< T > mid(qsizetype pos, qsizetype len=-1) const
void append(parameter_type t)
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
QList< T > findChildren(const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns all children of this object with the given name that can be cast to type T,...
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
@ SH_DialogButtonBox_ButtonsHaveIcons
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
StandardPixmap
This enum describes the available standard pixmaps.
@ SP_RestoreDefaultsButton
@ SP_DialogYesToAllButton
@ SE_PushButtonLayoutItem
The QVBoxLayout class lines up widgets vertically.
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ WA_WState_OwnSizePolicy
DBusConnection const char * rule
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble GLdouble GLdouble q
QFileDialog dialog(this)
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent