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);
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 (auto &&[key, value] : std::as_const(standardButtonHash).asKeyValueRange()) {
430 const QString text = QGuiApplicationPrivate::platformTheme()->standardButtonText(value);
431 if (!text.isEmpty())
432 key->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->standardButtonHash.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 return visibleButtons() << hiddenButtons.keys();
684}
685
693{
694 Q_D(const QDialogButtonBox);
695 for (int i = 0; i < NRoles; ++i) {
696 const QList<QAbstractButton *> &list = d->buttonLists[i];
697 for (int j = 0; j < list.size(); ++j) {
698 if (list.at(j) == button)
699 return ButtonRole(i);
700 }
701 }
702 return d->hiddenButtons.value(button, InvalidRole);
703}
704
715
728{
729 if (!button)
730 return;
731
732 // Remove button from hidden buttons and roles
734 for (int i = 0; i < QDialogButtonBox::NRoles; ++i)
735 buttonLists[i].removeOne(button);
736
737 switch (reason) {
739 button->setParent(nullptr);
747 standardButtonHash.remove(reinterpret_cast<QPushButton *>(button));
748 break;
750 break;
751 }
752}
753
766{
767 Q_D(QDialogButtonBox);
768 if (Q_UNLIKELY(role <= InvalidRole || role >= NRoles)) {
769 qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
770 return;
771 }
773 button->setParent(this);
774 d->addButton(button, role);
775}
776
785{
786 Q_D(QDialogButtonBox);
787 if (Q_UNLIKELY(role <= InvalidRole || role >= NRoles)) {
788 qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
789 return nullptr;
790 }
791 QPushButton *button = new QPushButton(text, this);
792 d->addButton(button, role);
793 return button;
794}
795
808
817void QDialogButtonBox::setStandardButtons(StandardButtons buttons)
818{
819 Q_D(QDialogButtonBox);
820 // Clear out all the old standard buttons, then recreate them.
821 const auto toDelete = std::exchange(d->standardButtonHash, {});
822 qDeleteAll(toDelete.keyBegin(), toDelete.keyEnd());
823
824 d->createStandardButtons(buttons);
825}
826
827QDialogButtonBox::StandardButtons QDialogButtonBox::standardButtons() const
828{
829 Q_D(const QDialogButtonBox);
830 StandardButtons standardButtons = NoButton;
832 while (it != d->standardButtonHash.constEnd()) {
833 standardButtons |= it.value();
834 ++it;
835 }
836 return standardButtons;
837}
838
846{
847 Q_D(const QDialogButtonBox);
848 return d->standardButtonHash.key(which);
849}
850
858{
859 Q_D(const QDialogButtonBox);
860 return d->standardButtonHash.value(static_cast<QPushButton *>(button));
861}
862
864{
865 Q_Q(QDialogButtonBox);
866 if (QAbstractButton *button = qobject_cast<QAbstractButton *>(q->sender())) {
867 // Can't fetch this *after* emitting clicked, as clicked may destroy the button
868 // or change its role. Now changing the role is not possible yet, but arguably
869 // both clicked and accepted/rejected/etc. should be emitted "atomically"
870 // depending on whatever role the button had at the time of the click.
871 const QDialogButtonBox::ButtonRole buttonRole = q->buttonRole(button);
872 QPointer<QDialogButtonBox> guard(q);
873
874 emit q->clicked(button);
875
876 if (!guard)
877 return;
878
882 emit q->accepted();
883 break;
886 emit q->rejected();
887 break;
889 emit q->helpRequested();
890 break;
891 default:
892 break;
893 }
894 }
895}
896
898{
899 Q_Q(QDialogButtonBox);
900 if (QObject *object = q->sender())
901 removeButton(reinterpret_cast<QAbstractButton *>(object), RemoveReason::Destroyed);
902}
903
905{
906 Q_Q(QDialogButtonBox);
907
908 const QEvent::Type type = event->type();
909
911 return false;
912
913 switch (type) {
915 const QDialogButtonBox::ButtonRole role = q->buttonRole(button);
920 }
921 break;
922 }
925 const auto role = hiddenButtons.take(button);
929 }
930 break;
931 default: break;
932 }
933
934 return false;
935}
936
949{
950 Q_D(QDialogButtonBox);
951 if (d->center != center) {
952 d->center = center;
953 d->resetLayout();
954 }
955}
956
958{
959 Q_D(const QDialogButtonBox);
960 return d->center;
961}
962
967{
968 typedef QHash<QPushButton *, QDialogButtonBox::StandardButton> StandardButtonHash;
969
970 Q_D(QDialogButtonBox);
971 switch (event->type()) {
972 case QEvent::StyleChange: // Propagate style
973 if (!d->standardButtonHash.empty()) {
974 QStyle *newStyle = style();
975 const StandardButtonHash::iterator end = d->standardButtonHash.end();
976 for (StandardButtonHash::iterator it = d->standardButtonHash.begin(); it != end; ++it)
977 it.key()->setStyle(newStyle);
978 }
979#ifdef Q_OS_MAC
982#endif
983 d->resetLayout();
985 break;
986 default:
988 break;
989 }
990}
991
993{
994 Q_Q(QDialogButtonBox);
995 const QList<QAbstractButton *> &acceptRoleList = buttonLists[QDialogButtonBox::AcceptRole];
996 QPushButton *firstAcceptButton = acceptRoleList.isEmpty()
997 ? nullptr
998 : qobject_cast<QPushButton *>(acceptRoleList.at(0));
999
1000 if (!firstAcceptButton)
1001 return;
1002
1003 bool hasDefault = false;
1004 QWidget *dialog = nullptr;
1005 QWidget *p = q;
1006 while (p && !p->isWindow()) {
1007 p = p->parentWidget();
1008 if ((dialog = qobject_cast<QDialog *>(p)))
1009 break;
1010 }
1011
1012 QWidget *parent = dialog ? dialog : q;
1014
1015 const auto pushButtons = parent->findChildren<QPushButton *>();
1016 for (QPushButton *pushButton : pushButtons) {
1017 if (pushButton->isDefault() && pushButton != firstAcceptButton) {
1018 hasDefault = true;
1019 break;
1020 }
1021 }
1022 if (!hasDefault && firstAcceptButton) {
1023 firstAcceptButton->setDefault(true);
1024 // When the QDialogButtonBox is focused, and it doesn't have an
1025 // explicit focus widget, it will transfer focus to its focus
1026 // proxy, which is the first button in the layout. This behavior,
1027 // combined with the behavior that QPushButtons in a QDialog will
1028 // by default have their autoDefault set to true, results in the
1029 // focus proxy/first button stealing the default button status
1030 // immediately when the button box is focused, which is not what
1031 // we want. Account for this by explicitly making the firstAcceptButton
1032 // focused as well, unless an explicit focus widget has been set, or
1033 // a dialog child has Qt::StrongFocus.
1035 || dialog->focusWidget()))
1036 firstAcceptButton->setFocus();
1037 }
1038}
1039
1041{
1042 Q_Q(QDialogButtonBox);
1043 const auto buttons = q->findChildren<QAbstractButton *>();
1044 for (auto *button : buttons)
1046}
1047
1052{
1053 Q_D(QDialogButtonBox);
1054 switch (event->type()) {
1055 case QEvent::Show:
1056 d->ensureFirstAcceptIsDefault();
1057 break;
1058
1060 d->retranslateStrings();
1061 break;
1062
1063 default: break;
1064 }
1065
1066 return QWidget::event(event);
1067}
1068
1070
1071#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
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)
QDialogButtonBox::ButtonRole buttonRole(QAbstractButton *button) const
QDialogButtonBoxPrivate(Qt::Orientation orient)
QHash< QPushButton *, QDialogButtonBox::StandardButton > standardButtonHash
QList< QAbstractButton * > visibleButtons() const
QHash< QAbstractButton *, QDialogButtonBox::ButtonRole > hiddenButtons
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
\inmodule QtCore
Definition qhash.h:1145
bool remove(const Key &key)
Removes the item that has the key from the hash.
Definition qhash.h:958
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it.
Definition qhash.h:985
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
Definition qhash.h:1086
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
Definition qhash.h:1007
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition qhash.h:1303
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
iterator begin()
Definition qset.h:136
const_iterator constBegin() const noexcept
Definition qset.h:139
const_iterator constEnd() const noexcept
Definition qset.h:143
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
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