Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdialogbuttonbox.cpp
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
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>
15
16#include "qdialogbuttonbox.h"
17#include "qdialogbuttonbox_p.h"
18
19#include <QtCore/qpointer.h>
20
22
118 : orientation(orient), buttonLayout(nullptr), center(false)
119{
120 struct EventFilter : public QObject
121 {
122 EventFilter(QDialogButtonBoxPrivate *d) : d(d) {};
123
124 bool eventFilter(QObject *obj, QEvent *event) override
125 {
126 QAbstractButton *button = qobject_cast<QAbstractButton *>(obj);
127 return button ? d->handleButtonShowAndHide(button, event) : false;
128 }
129
130 private:
132
133 };
134
135 filter.reset(new EventFilter(this));
136}
137
139{
140 Q_Q(QDialogButtonBox);
142 bool createNewLayout = buttonLayout == nullptr
143 || (orientation == Qt::Horizontal && qobject_cast<QVBoxLayout *>(buttonLayout) != 0)
144 || (orientation == Qt::Vertical && qobject_cast<QHBoxLayout *>(buttonLayout) != 0);
145 if (createNewLayout) {
146 delete buttonLayout;
149 else
151 }
152
153 int left, top, right, bottom;
157
158 if (!q->testAttribute(Qt::WA_WState_OwnSizePolicy)) {
161 sp.transpose();
162 q->setSizePolicy(sp);
163 q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
164 }
165}
166
172
173void QDialogButtonBoxPrivate::addButtonsToLayout(const QList<QAbstractButton *> &buttonList,
174 bool reverse)
175{
176 int start = reverse ? buttonList.size() - 1 : 0;
177 int end = reverse ? -1 : buttonList.size();
178 int step = reverse ? -1 : 1;
179
180 for (int i = start; i != end; i += step) {
181 QAbstractButton *button = buttonList.at(i);
183 button->show();
184 }
185}
186
188{
189 Q_Q(QDialogButtonBox);
190 const int MacGap = 36 - 8; // 8 is the default gap between a widget and a spacer item
191
193 for (int i = buttonLayout->count() - 1; i >= 0; --i) {
195 if (QWidget *widget = item->widget())
196 widget->hide();
197 delete item;
198 }
199
200 int tmpPolicy = layoutPolicy;
201
202 static const int M = 5;
205 if (tmpPolicy == QDialogButtonBox::MacLayout) {
206 bool hasModalButton = false;
207 for (int i = 0; i < M; ++i) {
208 if (!buttonLists[ModalRoles[i]].isEmpty()) {
209 hasModalButton = true;
210 break;
211 }
212 }
213 if (!hasModalButton)
214 tmpPolicy = 4; // Mac modeless
215 }
216
217 const int *currentLayout = QPlatformDialogHelper::buttonLayout(
218 orientation, static_cast<QPlatformDialogHelper::ButtonLayout>(tmpPolicy));
219
220 if (center)
222
223 const QList<QAbstractButton *> &acceptRoleList = buttonLists[QPlatformDialogHelper::AcceptRole];
224
225 while (*currentLayout != QPlatformDialogHelper::EOL) {
226 int role = (*currentLayout & ~QPlatformDialogHelper::Reverse);
227 bool reverse = (*currentLayout & QPlatformDialogHelper::Reverse);
228
229 switch (role) {
231 if (!center)
233 break;
235 if (acceptRoleList.isEmpty())
236 break;
237 // Only the first one
238 QAbstractButton *button = acceptRoleList.first();
240 button->show();
241 }
242 break;
244 if (acceptRoleList.size() > 1)
245 addButtonsToLayout(acceptRoleList.mid(1), reverse);
246 break;
248 {
249 const QList<QAbstractButton *> &list = buttonLists[role];
250
251 /*
252 Mac: Insert a gap on the left of the destructive
253 buttons to ensure that they don't get too close to
254 the help and action buttons (but only if there are
255 some buttons to the left of the destructive buttons
256 (and the stretch, whence buttonLayout->count() > 1
257 and not 0)).
258 */
259 if (tmpPolicy == QDialogButtonBox::MacLayout
260 && !list.isEmpty() && buttonLayout->count() > 1)
261 buttonLayout->addSpacing(MacGap);
262
263 addButtonsToLayout(list, reverse);
264
265 /*
266 Insert a gap between the destructive buttons and the
267 accept and reject buttons.
268 */
269 if (tmpPolicy == QDialogButtonBox::MacLayout && !list.isEmpty())
270 buttonLayout->addSpacing(MacGap);
271 }
272 break;
280 addButtonsToLayout(buttonLists[role], reverse);
281 }
282 ++currentLayout;
283 }
284
285 QWidgetList layoutWidgets;
286 for (int i = 0; i < buttonLayout->count(); ++i) {
287 if (auto *widget = buttonLayout->itemAt(i)->widget())
288 layoutWidgets << widget;
289 }
290
291 q->setFocusProxy(nullptr);
292 if (!layoutWidgets.isEmpty()) {
293 QWidget *prev = layoutWidgets.constLast();
294 for (QWidget *here : layoutWidgets) {
295 QWidget::setTabOrder(prev, here);
296 prev = here;
297 if (auto *pushButton = qobject_cast<QPushButton *>(prev); pushButton && pushButton->isDefault())
299 }
300 }
301
302 if (center)
304}
305
307 LayoutRule layoutRule)
308{
309 Q_Q(QDialogButtonBox);
310 int icon = 0;
311
312 switch (sbutton) {
315 break;
318 break;
321 break;
324 break;
327 break;
330 break;
333 break;
336 break;
339 break;
342 break;
345 break;
348 break;
351 break;
354 break;
357 break;
360 break;
363 break;
366 break;
368 return nullptr;
369 ;
370 }
371 QPushButton *button = new QPushButton(QGuiApplicationPrivate::platformTheme()->standardButtonText(sbutton), q);
372 QStyle *style = q->style();
373 if (style->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, nullptr, q) && icon != 0)
375 if (style != QApplication::style()) // Propagate style
376 button->setStyle(style);
377 standardButtonMap.insert(button, sbutton);
380 qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
381 else
382 addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), layoutRule);
383#if QT_CONFIG(shortcut)
384 const QKeySequence standardShortcut = QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton);
385 if (!standardShortcut.isEmpty())
386 button->setShortcut(standardShortcut);
387#endif
388 return button;
389}
390
415
416void QDialogButtonBoxPrivate::createStandardButtons(QDialogButtonBox::StandardButtons buttons)
417{
420 if (i & buttons)
422 i = i << 1;
423 }
425}
426
428{
429 for (const auto &it : std::as_const(standardButtonMap)) {
430 const QString text = QGuiApplicationPrivate::platformTheme()->standardButtonText(it.second);
431 if (!text.isEmpty())
432 it.first->setText(text);
433 }
434}
435
442 : QDialogButtonBox(Qt::Horizontal, parent)
443{
444}
445
452 : QWidget(*new QDialogButtonBoxPrivate(orientation), parent, { })
453{
454 d_func()->initLayout();
455}
456
465QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent)
466 : QDialogButtonBox(buttons, Qt::Horizontal, parent)
467{
468}
469
476QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation,
477 QWidget *parent)
478 : QDialogButtonBox(orientation, parent)
479{
480 d_func()->createStandardButtons(buttons);
481}
482
487{
488 Q_D(QDialogButtonBox);
489
490 d->ignoreShowAndHide = true;
491
492 // QObjectPrivate::connect requires explicit disconnect in destructor
493 // otherwise the connection may kick in on child destruction and reach
494 // the parent's destroyed private object
495 d->disconnectAll();
496}
497
502
525
623{
624 return d_func()->orientation;
625}
626
628{
629 Q_D(QDialogButtonBox);
630 if (orientation == d->orientation)
631 return;
632
633 d->orientation = orientation;
634 d->resetLayout();
635}
636
643{
644 Q_D(QDialogButtonBox);
645 // Remove the created standard buttons, they should be in the other lists, which will
646 // do the deletion
647 d->standardButtonMap.clear();
648 for (int i = 0; i < NRoles; ++i) {
649 QList<QAbstractButton *> &list = d->buttonLists[i];
650 for (auto button : std::as_const(list)) {
653 delete button;
654 }
655 list.clear();
656 }
657}
658
664QList<QAbstractButton *> QDialogButtonBox::buttons() const
665{
666 Q_D(const QDialogButtonBox);
667 return d->allButtons();
668}
669
670QList<QAbstractButton *> QDialogButtonBoxPrivate::visibleButtons() const
671{
672 QList<QAbstractButton *> finalList;
673 for (int i = 0; i < QDialogButtonBox::NRoles; ++i) {
674 const QList<QAbstractButton *> &list = buttonLists[i];
675 for (int j = 0; j < list.size(); ++j)
676 finalList.append(list.at(j));
677 }
678 return finalList;
679}
680
681QList<QAbstractButton *> QDialogButtonBoxPrivate::allButtons() const
682{
683 QList<QAbstractButton *> ret(visibleButtons());
684 ret.reserve(ret.size() + hiddenButtons.size());
685 for (const auto &it : hiddenButtons)
686 ret.push_back(it.first);
687 return ret;
688}
689
697{
698 Q_D(const QDialogButtonBox);
699 for (int i = 0; i < NRoles; ++i) {
700 const QList<QAbstractButton *> &list = d->buttonLists[i];
701 for (int j = 0; j < list.size(); ++j) {
702 if (list.at(j) == button)
703 return ButtonRole(i);
704 }
705 }
706 return d->hiddenButtons.value(button, InvalidRole);
707}
708
719
732{
733 if (!button)
734 return;
735
736 // Remove button from hidden buttons and roles
737 hiddenButtons.remove(button);
738 for (int i = 0; i < QDialogButtonBox::NRoles; ++i)
739 buttonLists[i].removeOne(button);
740
741 switch (reason) {
743 button->setParent(nullptr);
751 standardButtonMap.remove(reinterpret_cast<QPushButton *>(button));
752 break;
754 break;
755 }
756}
757
770{
771 Q_D(QDialogButtonBox);
772 if (Q_UNLIKELY(role <= InvalidRole || role >= NRoles)) {
773 qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
774 return;
775 }
777 button->setParent(this);
778 d->addButton(button, role);
779}
780
789{
790 Q_D(QDialogButtonBox);
791 if (Q_UNLIKELY(role <= InvalidRole || role >= NRoles)) {
792 qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
793 return nullptr;
794 }
795 QPushButton *button = new QPushButton(text, this);
796 d->addButton(button, role);
797 return button;
798}
799
812
821void QDialogButtonBox::setStandardButtons(StandardButtons buttons)
822{
823 Q_D(QDialogButtonBox);
824 // Clear out all the old standard buttons, then recreate them.
825 const auto oldButtons = d->standardButtonMap.keys();
826 d->standardButtonMap.clear();
827 qDeleteAll(oldButtons);
828
829 d->createStandardButtons(buttons);
830}
831
832QDialogButtonBox::StandardButtons QDialogButtonBox::standardButtons() const
833{
834 Q_D(const QDialogButtonBox);
835 StandardButtons standardButtons = NoButton;
836 for (const auto value : d->standardButtonMap.values())
838 return standardButtons;
839}
840
848{
849 Q_D(const QDialogButtonBox);
850
851 for (const auto &it : std::as_const(d->standardButtonMap)) {
852 if (it.second == which)
853 return it.first;
854 }
855 return nullptr;
856}
857
865{
866 Q_D(const QDialogButtonBox);
867 return d->standardButtonMap.value(static_cast<QPushButton *>(button));
868}
869
871{
872 Q_Q(QDialogButtonBox);
873 if (QAbstractButton *button = qobject_cast<QAbstractButton *>(q->sender())) {
874 // Can't fetch this *after* emitting clicked, as clicked may destroy the button
875 // or change its role. Now changing the role is not possible yet, but arguably
876 // both clicked and accepted/rejected/etc. should be emitted "atomically"
877 // depending on whatever role the button had at the time of the click.
878 const QDialogButtonBox::ButtonRole buttonRole = q->buttonRole(button);
879 QPointer<QDialogButtonBox> guard(q);
880
881 emit q->clicked(button);
882
883 if (!guard)
884 return;
885
889 emit q->accepted();
890 break;
893 emit q->rejected();
894 break;
896 emit q->helpRequested();
897 break;
898 default:
899 break;
900 }
901 }
902}
903
905{
906 Q_Q(QDialogButtonBox);
907 if (QObject *object = q->sender())
908 removeButton(reinterpret_cast<QAbstractButton *>(object), RemoveReason::Destroyed);
909}
910
912{
913 Q_Q(QDialogButtonBox);
914
915 const QEvent::Type type = event->type();
916
918 return false;
919
920 switch (type) {
922 const QDialogButtonBox::ButtonRole role = q->buttonRole(button);
925 hiddenButtons.insert(button, role);
927 }
928 break;
929 }
931 if (hiddenButtons.contains(button)) {
932 const auto role = hiddenButtons.take(button);
936 }
937 break;
938 default: break;
939 }
940
941 return false;
942}
943
956{
957 Q_D(QDialogButtonBox);
958 if (d->center != center) {
959 d->center = center;
960 d->resetLayout();
961 }
962}
963
965{
966 Q_D(const QDialogButtonBox);
967 return d->center;
968}
969
974{
975 Q_D(QDialogButtonBox);
976 switch (event->type()) {
977 case QEvent::StyleChange: // Propagate style
978 if (!d->standardButtonMap.empty()) {
979 QStyle *newStyle = style();
980 for (auto key : d->standardButtonMap.keys())
981 key->setStyle(newStyle);
982 }
983#ifdef Q_OS_MAC
986#endif
987 d->resetLayout();
989 break;
990 default:
992 break;
993 }
994}
995
997{
998 Q_Q(QDialogButtonBox);
999 const QList<QAbstractButton *> &acceptRoleList = buttonLists[QDialogButtonBox::AcceptRole];
1000 QPushButton *firstAcceptButton = acceptRoleList.isEmpty()
1001 ? nullptr
1002 : qobject_cast<QPushButton *>(acceptRoleList.at(0));
1003
1004 if (!firstAcceptButton)
1005 return;
1006
1007 bool hasDefault = false;
1008 QWidget *dialog = nullptr;
1009 QWidget *p = q;
1010 while (p && !p->isWindow()) {
1011 p = p->parentWidget();
1012 if ((dialog = qobject_cast<QDialog *>(p)))
1013 break;
1014 }
1015
1016 QWidget *parent = dialog ? dialog : q;
1018
1019 const auto pushButtons = parent->findChildren<QPushButton *>();
1020 for (QPushButton *pushButton : pushButtons) {
1021 if (pushButton->isDefault() && pushButton != firstAcceptButton) {
1022 hasDefault = true;
1023 break;
1024 }
1025 }
1026 if (!hasDefault && firstAcceptButton) {
1027 firstAcceptButton->setDefault(true);
1028 // When the QDialogButtonBox is focused, and it doesn't have an
1029 // explicit focus widget, it will transfer focus to its focus
1030 // proxy, which is the first button in the layout. This behavior,
1031 // combined with the behavior that QPushButtons in a QDialog will
1032 // by default have their autoDefault set to true, results in the
1033 // focus proxy/first button stealing the default button status
1034 // immediately when the button box is focused, which is not what
1035 // we want. Account for this by explicitly making the firstAcceptButton
1036 // focused as well, unless an explicit focus widget has been set, or
1037 // a dialog child has Qt::StrongFocus.
1039 || dialog->focusWidget()))
1040 firstAcceptButton->setFocus();
1041 }
1042}
1043
1045{
1046 Q_Q(QDialogButtonBox);
1047 const auto buttons = q->findChildren<QAbstractButton *>();
1048 for (auto *button : buttons)
1050}
1051
1056{
1057 Q_D(QDialogButtonBox);
1058 switch (event->type()) {
1059 case QEvent::Show:
1060 d->ensureFirstAcceptIsDefault();
1061 break;
1062
1064 d->retranslateStrings();
1065 break;
1066
1067 default: break;
1068 }
1069
1070 return QWidget::event(event);
1071}
1072
1074
1075#include "moc_qdialogbuttonbox.cpp"
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
void setShortcut(const QKeySequence &key)
void setIcon(const QIcon &icon)
void clicked(bool checked=false)
This signal is emitted when the button is activated (i.e., pressed down then released while the mouse...
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
QVarLengthFlatMap< QPushButton *, QDialogButtonBox::StandardButton, 8 > standardButtonMap
QList< QAbstractButton * > buttonLists[QDialogButtonBox::NRoles]
QList< QAbstractButton * > allButtons() const
QPushButton * createButton(QDialogButtonBox::StandardButton button, LayoutRule layoutRule=LayoutRule::DoLayout)
void removeButton(QAbstractButton *button, RemoveReason reason)
void addButton(QAbstractButton *button, QDialogButtonBox::ButtonRole role, LayoutRule layoutRule=LayoutRule::DoLayout, AddRule addRule=AddRule::Connect)
bool handleButtonShowAndHide(QAbstractButton *button, QEvent *event)
void createStandardButtons(QDialogButtonBox::StandardButtons buttons)
QVarLengthFlatMap< QAbstractButton *, QDialogButtonBox::ButtonRole, 8 > hiddenButtons
QDialogButtonBox::ButtonRole buttonRole(QAbstractButton *button) const
QDialogButtonBoxPrivate(Qt::Orientation orient)
QList< QAbstractButton * > visibleButtons() const
QDialogButtonBox::ButtonLayout layoutPolicy
void addButtonsToLayout(const QList< QAbstractButton * > &buttonList, bool reverse)
The QDialogButtonBox class is a widget that presents buttons in a layout that is appropriate to the c...
bool centerButtons
whether the buttons in the button box are centered
void changeEvent(QEvent *event) override
\reimp
ButtonRole buttonRole(QAbstractButton *button) const
Returns the button role for the specified button.
void addButton(QAbstractButton *button, ButtonRole role)
Adds the given button to the button box with the specified role.
void setStandardButtons(StandardButtons buttons)
StandardButton
These enums describe flags for standard buttons.
QPushButton * button(StandardButton which) const
Returns the QPushButton corresponding to the standard button which, or \nullptr if the standard butto...
~QDialogButtonBox()
Destroys the button box.
ButtonLayout
This enum describes the layout policy to be used when arranging the buttons contained in the button b...
StandardButton standardButton(QAbstractButton *button) const
Returns the standard button enum value corresponding to the given button, or NoButton if the given bu...
Qt::Orientation orientation
the orientation of the button box
QDialogButtonBox(QWidget *parent=nullptr)
Constructs an empty, horizontal button box with the given parent.
void setOrientation(Qt::Orientation orientation)
void setCenterButtons(bool center)
QList< QAbstractButton * > buttons() const
Returns a list of all buttons that have been added to the button box.
StandardButtons standardButtons
collection of standard buttons in the button box
void clear()
Clears the button box, deleting all buttons within it.
void removeButton(QAbstractButton *button)
Removes button from the button box without deleting it and sets its parent to zero.
bool event(QEvent *event) override
\reimp
\inmodule QtCore
Definition qcoreevent.h:45
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
@ StyleChange
Definition qcoreevent.h:136
@ LanguageChange
Definition qcoreevent.h:123
@ HideToParent
Definition qcoreevent.h:86
@ MacSizeChange
Definition qcoreevent.h:217
@ ShowToParent
Definition qcoreevent.h:85
static QPlatformTheme * platformTheme()
The QHBoxLayout class lines up widgets horizontally.
Definition qboxlayout.h:78
The QKeySequence class encapsulates a key sequence as used by shortcuts.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition qlayoutitem.h:25
virtual QWidget * widget() const
If this item manages a QWidget, returns that widget.
void setContentsMargins(int left, int top, int right, int bottom)
Definition qlayout.cpp:288
qsizetype size() const noexcept
Definition qlist.h:397
bool isEmpty() const noexcept
Definition qlist.h:401
const T & constLast() const noexcept
Definition qlist.h:650
const_reference at(qsizetype i) const noexcept
Definition qlist.h:446
void append(parameter_type t)
Definition qlist.h:458
void clear()
Definition qlist.h:434
QObject * parent
Definition qobject.h:73
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)
Definition qobject_p.h:299
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
Definition qobject_p.h:328
\inmodule QtCore
Definition qobject.h:103
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
Definition qobject.cpp:2339
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition qobject.cpp:2658
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
Definition qobject.cpp:2370
QList< T > findChildren(QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns all children of this object with the given name that can be cast to type T,...
Definition qobject.h:164
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
static const int * buttonLayout(Qt::Orientation orientation=Qt::Horizontal, ButtonLayout policy=UnknownLayout)
static ButtonRole buttonRole(StandardButton button)
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
void setDefault(bool)
bool isDefault() const
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
Definition qsizepolicy.h:18
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
Definition qstyle.h:29
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
@ SH_DialogButtonBox_ButtonsHaveIcons
Definition qstyle.h:656
@ SH_DialogButtonLayout
Definition qstyle.h:653
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.
Definition qstyle.h:716
@ SP_DialogDiscardButton
Definition qstyle.h:764
@ SP_DialogRetryButton
Definition qstyle.h:792
@ SP_DialogNoButton
Definition qstyle.h:766
@ SP_RestoreDefaultsButton
Definition qstyle.h:794
@ SP_DialogCloseButton
Definition qstyle.h:761
@ SP_DialogOpenButton
Definition qstyle.h:759
@ SP_DialogSaveAllButton
Definition qstyle.h:790
@ SP_DialogCancelButton
Definition qstyle.h:757
@ SP_DialogIgnoreButton
Definition qstyle.h:793
@ SP_DialogHelpButton
Definition qstyle.h:758
@ SP_DialogSaveButton
Definition qstyle.h:760
@ SP_DialogNoToAllButton
Definition qstyle.h:789
@ SP_DialogResetButton
Definition qstyle.h:763
@ SP_DialogOkButton
Definition qstyle.h:756
@ SP_DialogAbortButton
Definition qstyle.h:791
@ SP_DialogYesButton
Definition qstyle.h:765
@ SP_DialogApplyButton
Definition qstyle.h:762
@ SP_DialogYesToAllButton
Definition qstyle.h:788
@ SE_PushButtonLayoutItem
Definition qstyle.h:294
The QVBoxLayout class lines up widgets vertically.
Definition qboxlayout.h:91
void setLayoutItemMargins(int left, int top, int right, int bottom)
bool hasChildWithFocusPolicy(Qt::FocusPolicy policy, const QWidget *excludeChildrenOf=nullptr) const
void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const
static QWidgetPrivate * get(QWidget *w)
Definition qwidget_p.h:212
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
void setStyle(QStyle *)
Sets the widget's GUI style to style.
Definition qwidget.cpp:2630
static void setTabOrder(QWidget *, QWidget *)
Puts the second widget after the first widget in the focus order.
Definition qwidget.cpp:6981
void setFocusProxy(QWidget *)
Sets the widget's focus proxy to widget w.
Definition qwidget.cpp:6368
QWidget * focusWidget() const
Returns the last child of this widget that setFocus had been called on.
Definition qwidget.cpp:6828
void hide()
Hides the widget.
Definition qwidget.cpp:8135
void show()
Shows the widget and its child widgets.
Definition qwidget.cpp:7875
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition qwidget.cpp:9382
bool event(QEvent *event) override
This is the main event handler; it handles event event.
Definition qwidget.cpp:8866
QStyle * style() const
Definition qwidget.cpp:2600
QWidget * parentWidget() const
Returns the parent of this widget, or \nullptr if it does not have any parent widget.
Definition qwidget.h:904
QPushButton
[1]
QOpenGLWidget * widget
[1]
QString text
QPushButton * button
[2]
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
Definition qcompare.h:63
@ WA_WState_OwnSizePolicy
Definition qnamespace.h:334
@ StrongFocus
Definition qnamespace.h:110
Orientation
Definition qnamespace.h:98
@ Horizontal
Definition qnamespace.h:99
@ Vertical
Definition qnamespace.h:100
#define Q_FALLTHROUGH()
#define Q_UNLIKELY(x)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qWarning
Definition qlogging.h:166
return ret
GLuint64 key
GLuint GLuint end
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble right
GLint left
GLenum type
GLint GLint bottom
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLuint start
struct _cl_event * event
GLhandleARB obj
[2]
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define M(_x, _y)
#define sp
#define emit
unsigned int uint
Definition qtypes.h:34
QList< int > list
[14]
QPushButton * pushButton
QObject::connect nullptr
QFileDialog dialog(this)
[1]
QGraphicsItem * item