QtBase  v6.3.1
qdialog.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtWidgets module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #include <QtWidgets/qtwidgetsglobal.h>
41 #if QT_CONFIG(colordialog)
42 #include "qcolordialog.h"
43 #endif
44 #if QT_CONFIG(fontdialog)
45 #include "qfontdialog.h"
46 #endif
47 #if QT_CONFIG(filedialog)
48 #include "qfiledialog.h"
49 #endif
50 
51 #include "qevent.h"
52 #include "qapplication.h"
53 #include "qlayout.h"
54 #if QT_CONFIG(sizegrip)
55 #include "qsizegrip.h"
56 #endif
57 #if QT_CONFIG(whatsthis)
58 #include "qwhatsthis.h"
59 #endif
60 #if QT_CONFIG(menu)
61 #include "qmenu.h"
62 #endif
63 #include "qcursor.h"
64 #if QT_CONFIG(messagebox)
65 #include "qmessagebox.h"
66 #endif
67 #if QT_CONFIG(errormessage)
68 #include "qerrormessage.h"
69 #endif
70 #include <qpa/qplatformtheme.h>
71 #include "private/qdialog_p.h"
72 #include "private/qguiapplication_p.h"
73 #ifndef QT_NO_ACCESSIBILITY
74 #include "qaccessible.h"
75 #endif
76 
78 
79 static inline int themeDialogType(const QDialog *dialog)
80 {
81 #if QT_CONFIG(filedialog)
82  if (qobject_cast<const QFileDialog *>(dialog))
84 #endif
85 #if QT_CONFIG(colordialog)
86  if (qobject_cast<const QColorDialog *>(dialog))
88 #endif
89 #if QT_CONFIG(fontdialog)
90  if (qobject_cast<const QFontDialog *>(dialog))
92 #endif
93 #if QT_CONFIG(messagebox)
94  if (qobject_cast<const QMessageBox *>(dialog))
96 #endif
97 #if QT_CONFIG(errormessage)
98  if (qobject_cast<const QErrorMessage *>(dialog))
100 #endif
101 #if !QT_CONFIG(filedialog) && !QT_CONFIG(colordialog) && !QT_CONFIG(fontdialog) && \
102  !QT_CONFIG(messagebox) && !QT_CONFIG(errormessage)
103  Q_UNUSED(dialog);
104 #endif
105  return -1;
106 }
107 
109 {
110  delete m_platformHelper;
111 }
112 
114 {
115  // Delayed creation of the platform, ensuring that
116  // that qobject_cast<> on the dialog works in the plugin.
117  if (!m_platformHelperCreated && canBeNativeDialog()) {
118  m_platformHelperCreated = true;
119  QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
120  QDialog *dialog = ncThis->q_func();
121  const int type = themeDialogType(dialog);
122  if (type >= 0) {
123  m_platformHelper = QGuiApplicationPrivate::platformTheme()
125  if (m_platformHelper) {
126  QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept()));
127  QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject()));
128  ncThis->initHelper(m_platformHelper);
129  }
130  }
131  }
132  return m_platformHelper;
133 }
134 
136 {
137  QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
138  QDialog *dialog = ncThis->q_func();
139  const int type = themeDialogType(dialog);
140  if (type >= 0)
143  return false;
144 }
145 
151 void QDialogPrivate::close(int resultCode)
152 {
153  Q_Q(QDialog);
154 
155  q->setResult(resultCode);
156 
157  if (!data.is_closing) {
158  // Until Qt 6.3 we didn't close dialogs, so they didn't receive a QCloseEvent.
159  // It is likely that subclasses implement closeEvent and handle them as rejection
160  // (like QMessageBox and QProgressDialog do), so eat those events.
161  struct CloseEventEater : QObject
162  {
163  using QObject::QObject;
164  protected:
165  bool eventFilter(QObject *o, QEvent *e) override
166  {
167  if (e->type() == QEvent::Close)
168  return true;
169  return QObject::eventFilter(o, e);
170  }
171  } closeEventEater;
172  q->installEventFilter(&closeEventEater);
174  } else {
175  // If the close was initiated outside of QDialog we will end up
176  // here via QDialog::closeEvent calling reject(), in which case
177  // we need to hide the dialog to ensure QDialog::closeEvent does
178  // not ignore the close event. FIXME: Why is QDialog doing this?
179  q->hide();
180  }
181 
183 }
184 
192 void QDialogPrivate::finalize(int resultCode, int dialogCode)
193 {
194  Q_Q(QDialog);
195 
196  if (dialogCode == QDialog::Accepted)
197  emit q->accepted();
198  else if (dialogCode == QDialog::Rejected)
199  emit q->rejected();
200 
201  emit q->finished(resultCode);
202 }
203 
205 {
206  Q_Q(const QDialog);
207  if (const QWidget *parent = q->nativeParentWidget())
208  return parent->windowHandle();
209  else if (q->windowHandle())
210  return q->windowHandle()->transientParent();
211  return nullptr;
212 }
213 
215 {
217  if (visible) {
218  Q_Q(QDialog);
219  helperPrepareShow(helper);
220  nativeDialogInUse = helper->show(q->windowFlags(), q->windowModality(), transientParentWindow());
221  } else if (nativeDialogInUse) {
222  helper->hide();
223  }
224  }
225  return nativeDialogInUse;
226 }
227 
229 {
231  return helper->styleHint(hint);
233 }
234 
236 {
237  delete m_platformHelper;
238  m_platformHelper = nullptr;
239  m_platformHelperCreated = false;
240  nativeDialogInUse = false;
241 }
242 
418 QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
419  : QWidget(*new QDialogPrivate, parent,
420  f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
421 {
422 }
423 
429  : QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
430 {
431 }
432 
438 {
439  QT_TRY {
440  // Need to hide() here, as our (to-be) overridden hide()
441  // will not be called in ~QWidget.
442  hide();
443  } QT_CATCH(...) {
444  // we're in the destructor - just swallow the exception
445  }
446 }
447 
455 #if QT_CONFIG(pushbutton)
456 void QDialogPrivate::setDefault(QPushButton *pushButton)
457 {
458  Q_Q(QDialog);
459  bool hasMain = false;
460  QList<QPushButton*> list = q->findChildren<QPushButton*>();
461  for (int i=0; i<list.size(); ++i) {
462  QPushButton *pb = list.at(i);
463  if (pb->window() == q) {
464  if (pb == mainDef)
465  hasMain = true;
466  if (pb != pushButton)
467  pb->setDefault(false);
468  }
469  }
470  if (!pushButton && hasMain)
471  mainDef->setDefault(true);
472  if (!hasMain)
473  mainDef = pushButton;
474 }
475 
481 void QDialogPrivate::setMainDefault(QPushButton *pushButton)
482 {
483  mainDef = nullptr;
484  setDefault(pushButton);
485 }
486 
492 void QDialogPrivate::hideDefault()
493 {
494  Q_Q(QDialog);
495  QList<QPushButton*> list = q->findChildren<QPushButton*>();
496  for (int i=0; i<list.size(); ++i) {
497  list.at(i)->setDefault(false);
498  }
499 }
500 #endif
501 
503 {
504  Q_Q(QDialog);
505  if (resetModalityTo != -1 && !q->testAttribute(Qt::WA_SetWindowModality)) {
506  // open() changed the window modality and the user didn't touch it afterwards; restore it
507  q->setWindowModality(Qt::WindowModality(resetModalityTo));
508  q->setAttribute(Qt::WA_SetWindowModality, wasModalitySet);
509 #ifdef Q_OS_MAC
511  q->setParent(q->parentWidget(), Qt::Dialog);
512 #endif
513  }
514  resetModalityTo = -1;
515 }
516 
527 int QDialog::result() const
528 {
529  Q_D(const QDialog);
530  return d->rescode;
531 }
532 
542 {
543  Q_D(QDialog);
544  d->rescode = r;
545 }
546 
556 {
557  Q_D(QDialog);
558 
559  Qt::WindowModality modality = windowModality();
560  if (modality != Qt::WindowModal) {
561  d->resetModalityTo = modality;
562  d->wasModalitySet = testAttribute(Qt::WA_SetWindowModality);
565 #ifdef Q_OS_MAC
567 #endif
568  }
569 
570  setResult(0);
571  show();
572 }
573 
596 {
597  Q_D(QDialog);
598 
599  if (Q_UNLIKELY(d->eventLoop)) {
600  qWarning("QDialog::exec: Recursive call detected");
601  return -1;
602  }
603 
604  bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose);
606 
607  d->resetModalitySetByOpen();
608 
609  bool wasShowModal = testAttribute(Qt::WA_ShowModal);
611  setResult(0);
612 
613  show();
614 
615  QPointer<QDialog> guard = this;
616  if (d->nativeDialogInUse) {
617  d->platformHelper()->exec();
618  } else {
619  QEventLoop eventLoop;
620  d->eventLoop = &eventLoop;
621  (void) eventLoop.exec(QEventLoop::DialogExec);
622  }
623  if (guard.isNull())
624  return QDialog::Rejected;
625  d->eventLoop = nullptr;
626 
627  setAttribute(Qt::WA_ShowModal, wasShowModal);
628 
629  int res = result();
630  if (d->nativeDialogInUse)
631  d->helperDone(static_cast<QDialog::DialogCode>(res), d->platformHelper());
632  if (deleteOnClose)
633  delete this;
634  return res;
635 }
636 
654 void QDialog::done(int r)
655 {
656  Q_D(QDialog);
657  d->close(r);
658  d->finalize(r, r);
659 }
660 
668 {
669  done(Accepted);
670 }
671 
679 {
680  done(Rejected);
681 }
682 
685 {
686  return QWidget::eventFilter(o, e);
687 }
688 
689 /*****************************************************************************
690  Event handlers
691  *****************************************************************************/
692 
693 #ifndef QT_NO_CONTEXTMENU
696 {
697 #if !QT_CONFIG(whatsthis) || !QT_CONFIG(menu)
698  Q_UNUSED(e);
699 #else
700  QWidget *w = childAt(e->pos());
701  if (!w) {
702  w = rect().contains(e->pos()) ? this : nullptr;
703  if (!w)
704  return;
705  }
706  while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis))
707  w = w->isWindow() ? nullptr : w->parentWidget();
708  if (w) {
709  QPointer<QMenu> p = new QMenu(this);
710  QAction *wt = p.data()->addAction(tr("What's This?"));
711  if (p.data()->exec(e->globalPos()) == wt) {
712  QHelpEvent e(QEvent::WhatsThis, w->rect().center(),
713  w->mapToGlobal(w->rect().center()));
715  }
716  delete p.data();
717  }
718 #endif
719 }
720 #endif // QT_NO_CONTEXTMENU
721 
724 {
725 #ifndef QT_NO_SHORTCUT
726  // Calls reject() if Escape is pressed. Simulates a button
727  // click for the default button if Enter is pressed. Move focus
728  // for the arrow keys. Ignore the rest.
729  if (e->matches(QKeySequence::Cancel)) {
730  reject();
731  } else
732 #endif
733  if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
734  switch (e->key()) {
735 #if QT_CONFIG(pushbutton)
736  case Qt::Key_Enter:
737  case Qt::Key_Return: {
738  QList<QPushButton*> list = findChildren<QPushButton*>();
739  for (int i=0; i<list.size(); ++i) {
740  QPushButton *pb = list.at(i);
741  if (pb->isDefault() && pb->isVisible()) {
742  if (pb->isEnabled())
743  pb->click();
744  return;
745  }
746  }
747  }
748  break;
749 #endif
750  default:
751  e->ignore();
752  return;
753  }
754  } else {
755  e->ignore();
756  }
757 }
758 
761 {
762 #if QT_CONFIG(whatsthis)
765 #endif
766  if (isVisible()) {
767  QPointer<QObject> that = this;
768  reject();
769  if (that && isVisible())
770  e->ignore();
771  } else {
772  e->accept();
773  }
774 }
775 
776 /*****************************************************************************
777  Geometry management.
778  *****************************************************************************/
779 
783 void QDialog::setVisible(bool visible)
784 {
785  Q_D(QDialog);
786  if (!testAttribute(Qt::WA_DontShowOnScreen) && d->canBeNativeDialog() && d->setNativeDialogVisible(visible))
787  return;
788 
789  // We should not block windows by the invisible modal dialog
790  // if a platform-specific dialog is implemented as an in-process
791  // Qt window, because in this case it will also be blocked.
792  const bool dontBlockWindows = testAttribute(Qt::WA_DontShowOnScreen)
793  && d->styleHint(QPlatformDialogHelper::DialogIsQtWindow).toBool();
794  Qt::WindowModality oldModality;
795  bool wasModalitySet;
796 
797  if (dontBlockWindows) {
798  oldModality = windowModality();
799  wasModalitySet = testAttribute(Qt::WA_SetWindowModality);
801  }
802 
803  if (visible) {
805  return;
806 
808 
809  // Window activation might be prevented. We can't test isActiveWindow here,
810  // as the window will be activated asynchronously by the window manager.
812  QWidget *fw = window()->focusWidget();
813  if (!fw)
814  fw = this;
815 
816  /*
817  The following block is to handle a special case, and does not
818  really follow proper logic in concern of autoDefault and TAB
819  order. However, it's here to ease usage for the users. If a
820  dialog has a default QPushButton, and first widget in the TAB
821  order also is a QPushButton, then we give focus to the main
822  default QPushButton. This simplifies code for the developers,
823  and actually catches most cases... If not, then they simply
824  have to use [widget*]->setFocus() themselves...
825  */
826 #if QT_CONFIG(pushbutton)
827  if (d->mainDef && fw->focusPolicy() == Qt::NoFocus) {
828  QWidget *first = fw;
829  while ((first = first->nextInFocusChain()) != fw && first->focusPolicy() == Qt::NoFocus)
830  ;
831  if (first != d->mainDef && qobject_cast<QPushButton*>(first))
832  d->mainDef->setFocus();
833  }
834  if (!d->mainDef && isWindow()) {
835  QWidget *w = fw;
836  while ((w = w->nextInFocusChain()) != fw) {
837  QPushButton *pb = qobject_cast<QPushButton *>(w);
838  if (pb && pb->autoDefault() && pb->focusPolicy() != Qt::NoFocus) {
839  pb->setDefault(true);
840  break;
841  }
842  }
843  }
844 #endif
845  if (fw && !fw->hasFocus()) {
848  }
849  }
850 
851 #ifndef QT_NO_ACCESSIBILITY
854 #endif
855 
856  } else {
858  return;
859 
860 #ifndef QT_NO_ACCESSIBILITY
861  if (isVisible()) {
864  }
865 #endif
866 
867  // Reimplemented to exit a modal event loop when the dialog is hidden.
869  if (d->eventLoop)
870  d->eventLoop->exit();
871  }
872 
873  if (dontBlockWindows) {
874  setWindowModality(oldModality);
875  setAttribute(Qt::WA_SetWindowModality, wasModalitySet);
876  }
877 
878 #if QT_CONFIG(pushbutton)
880  if (d->mainDef && isActiveWindow()
882  QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center()));
883 #endif
884 }
885 
888 {
889  if (!event->spontaneous() && !testAttribute(Qt::WA_Moved)) {
890  Qt::WindowStates state = windowState();
892  setAttribute(Qt::WA_Moved, false); // not really an explicit position
893  if (state != windowState())
895  }
896 }
897 
900 {
901  Q_D(QDialog);
902 
904  if (theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool())
905  return;
906  QPoint p(0, 0);
907  int extraw = 0, extrah = 0;
908  const QWindow *parentWindow = nullptr;
909  if (w) {
910  w = w->window();
911  } else {
912  parentWindow = d->transientParentWindow();
913  }
914  QRect desk;
915  QScreen *scrn = nullptr;
916  if (w)
917  scrn = w->screen();
918  else if (parentWindow)
919  scrn = parentWindow->screen();
920  else if (QGuiApplication::primaryScreen()->virtualSiblings().size() > 1)
922  else
923  scrn = screen();
924  if (scrn)
925  desk = scrn->availableGeometry();
926 
928  for (int i = 0; (extraw == 0 || extrah == 0) && i < list.size(); ++i) {
929  QWidget * current = list.at(i);
930  if (current->isVisible()) {
931  int framew = current->geometry().x() - current->x();
932  int frameh = current->geometry().y() - current->y();
933 
934  extraw = qMax(extraw, framew);
935  extrah = qMax(extrah, frameh);
936  }
937  }
938 
939  // sanity check for decoration frames. With embedding, we
940  // might get extraordinary values
941  if (extraw == 0 || extrah == 0 || extraw >= 10 || extrah >= 40) {
942  extrah = 40;
943  extraw = 10;
944  }
945 
946 
947  if (w) {
948  // Use pos() if the widget is embedded into a native window
949  QPoint pp;
950  if (w->windowHandle() && qvariant_cast<WId>(w->windowHandle()->property("_q_embedded_native_parent_handle")))
951  pp = w->pos();
952  else
953  pp = w->mapToGlobal(QPoint(0,0));
954  p = QPoint(pp.x() + w->width()/2,
955  pp.y() + w->height()/ 2);
956  } else if (parentWindow) {
957  // QTBUG-63406: Widget-based dialog in QML, which has no Widget parent
958  // but a transient parent window.
959  QPoint pp = parentWindow->mapToGlobal(QPoint(0, 0));
960  p = QPoint(pp.x() + parentWindow->width() / 2, pp.y() + parentWindow->height() / 2);
961  } else {
962  // p = middle of the desktop
963  p = QPoint(desk.x() + desk.width()/2, desk.y() + desk.height()/2);
964  }
965 
966  // p = origin of this
967  p = QPoint(p.x()-width()/2 - extraw,
968  p.y()-height()/2 - extrah);
969 
970 
971  if (p.x() + extraw + width() > desk.x() + desk.width())
972  p.setX(desk.x() + desk.width() - width() - extraw);
973  if (p.x() < desk.x())
974  p.setX(desk.x());
975 
976  if (p.y() + extrah + height() > desk.y() + desk.height())
977  p.setY(desk.y() + desk.height() - height() - extrah);
978  if (p.y() < desk.y())
979  p.setY(desk.y());
980 
981  // QTBUG-52735: Manually set the correct target screen since scaling in a
982  // subsequent call to QWindow::resize() may otherwise use the wrong factor
983  // if the screen changed notification is still in an event queue.
984  if (scrn) {
985  if (QWindow *window = windowHandle())
986  window->setScreen(scrn);
987  }
988 
989  move(p);
990 }
991 
994 {
995  Q_D(const QDialog);
996  if (d->extension) {
997  if (d->orientation == Qt::Horizontal)
998  return QSize(QWidget::sizeHint().width(),
999  qMax(QWidget::sizeHint().height(),d->extension->sizeHint().height()));
1000  else
1001  return QSize(qMax(QWidget::sizeHint().width(), d->extension->sizeHint().width()),
1003  }
1004  return QWidget::sizeHint();
1005 }
1006 
1007 
1010 {
1011  Q_D(const QDialog);
1012  if (d->extension) {
1013  if (d->orientation == Qt::Horizontal)
1015  qMax(QWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height()));
1016  else
1017  return QSize(qMax(QWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width()),
1019  }
1020 
1021  return QWidget::minimumSizeHint();
1022 }
1023 
1038 void QDialog::setModal(bool modal)
1039 {
1041 }
1042 
1043 
1045 {
1046 #if QT_CONFIG(sizegrip)
1047  Q_D(const QDialog);
1048  return !!d->resizer;
1049 #else
1050  return false;
1051 #endif
1052 }
1053 
1054 
1056 {
1057 #if !QT_CONFIG(sizegrip)
1058  Q_UNUSED(enabled);
1059 #else
1060  Q_D(QDialog);
1061 #if QT_CONFIG(sizegrip)
1062  d->sizeGripEnabled = enabled;
1063  if (enabled && d->doShowExtension)
1064  return;
1065 #endif
1066  if (!enabled != !d->resizer) {
1067  if (enabled) {
1068  d->resizer = new QSizeGrip(this);
1069  // adjustSize() processes all events, which is suboptimal
1070  d->resizer->resize(d->resizer->sizeHint());
1071  if (isRightToLeft())
1072  d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft());
1073  else
1074  d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight());
1075  d->resizer->raise();
1076  d->resizer->show();
1077  } else {
1078  delete d->resizer;
1079  d->resizer = nullptr;
1080  }
1081  }
1082 #endif // QT_CONFIG(sizegrip)
1083 }
1084 
1085 
1086 
1089 {
1090 #if QT_CONFIG(sizegrip)
1091  Q_D(QDialog);
1092  if (d->resizer) {
1093  if (isRightToLeft())
1094  d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft());
1095  else
1096  d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight());
1097  d->resizer->raise();
1098  }
1099 #endif
1100 }
1101 
1145 #include "moc_qdialog.cpp"
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
[0]
Definition: dialog.h:60
The QAccessibleEvent class is the base class for accessibility notifications.
Definition: qaccessible.h:680
static void updateAccessibility(QAccessibleEvent *event)
The QAction class provides an abstraction for user commands that can be added to different user inter...
Definition: qaction.h:65
QVariant data() const
Definition: qaction.cpp:1086
static QWidgetList topLevelWidgets()
The QCloseEvent class contains parameters that describe a close event.
Definition: qevent.h:629
The QContextMenuEvent class contains parameters that describe a context menu event....
Definition: qevent.h:665
static bool sendEvent(QObject *receiver, QEvent *event)
static void setPos(int x, int y)
Definition: qcursor.cpp:276
static QPoint pos()
Definition: qcursor.cpp:224
The QDialog class is the base class of dialog windows.
Definition: qdialog.h:55
void closeEvent(QCloseEvent *) override
Definition: qdialog.cpp:760
QSize sizeHint() const override
Definition: qdialog.cpp:993
bool isSizeGripEnabled() const
Definition: qdialog.cpp:1044
bool eventFilter(QObject *, QEvent *) override
Definition: qdialog.cpp:684
void setSizeGripEnabled(bool)
Definition: qdialog.cpp:1055
virtual void reject()
Definition: qdialog.cpp:678
void setResult(int r)
Definition: qdialog.cpp:541
~QDialog()
Definition: qdialog.cpp:437
void keyPressEvent(QKeyEvent *) override
Definition: qdialog.cpp:723
virtual int exec()
Definition: qdialog.cpp:595
QSize minimumSizeHint() const override
Definition: qdialog.cpp:1009
int result() const
Definition: qdialog.cpp:527
DialogCode
Definition: qdialog.h:66
@ Accepted
Definition: qdialog.h:66
@ Rejected
Definition: qdialog.h:66
void setModal(bool modal)
Definition: qdialog.cpp:1038
void resizeEvent(QResizeEvent *) override
Definition: qdialog.cpp:1088
void showEvent(QShowEvent *) override
Definition: qdialog.cpp:887
void contextMenuEvent(QContextMenuEvent *) override
Definition: qdialog.cpp:695
QDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Definition: qdialog.cpp:418
virtual void done(int)
Definition: qdialog.cpp:654
void adjustPosition(QWidget *)
Definition: qdialog.cpp:899
virtual void open()
Definition: qdialog.cpp:555
void setVisible(bool visible) override
Definition: qdialog.cpp:783
bool modal
whether show() should pop up the dialog as modal or modeless
Definition: qdialog.h:60
virtual void accept()
Definition: qdialog.cpp:667
bool setNativeDialogVisible(bool visible)
Definition: qdialog.cpp:214
QPlatformDialogHelper * platformHelper() const
Definition: qdialog.cpp:113
void deletePlatformHelper()
Definition: qdialog.cpp:235
virtual bool canBeNativeDialog() const
Definition: qdialog.cpp:135
void finalize(int resultCode, int dialogCode)
Definition: qdialog.cpp:192
bool wasModalitySet
Definition: qdialog_p.h:117
QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const
Definition: qdialog.cpp:228
int resetModalityTo
Definition: qdialog_p.h:116
void resetModalitySetByOpen()
Definition: qdialog.cpp:502
bool nativeDialogInUse
Definition: qdialog_p.h:121
QWindow * transientParentWindow() const
Definition: qdialog.cpp:204
The QEvent class is the base class of all event classes. Event objects contain event parameters.
Definition: qcoreevent.h:58
@ Close
Definition: qcoreevent.h:91
@ FocusIn
Definition: qcoreevent.h:79
@ WhatsThis
Definition: qcoreevent.h:161
The QEventLoop class provides a means of entering and leaving an event loop.
Definition: qeventloop.h:50
int exec(ProcessEventsFlags flags=AllEvents)
Definition: qeventloop.cpp:162
The QFocusEvent class contains event parameters for widget focus events. \inmodule QtGui.
Definition: qevent.h:520
QScreen * primaryScreen
the primary (or default) screen of the application.
static QScreen * screenAt(const QPoint &point)
static QPlatformTheme * platformTheme()
The QHelpEvent class provides an event that is used to request helpful information about a particular...
Definition: qevent.h:873
The QKeyEvent class describes a key event.
Definition: qevent.h:471
Definition: qlist.h:108
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.
Definition: qmenu.h:62
QObject * parent
Definition: qobject.h:99
The QObject class is the base class of all Qt objects.
Definition: qobject.h:125
Q_INVOKABLE QObject(QObject *parent=nullptr)
Definition: qobject.cpp:913
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Definition: qobject.cpp:2772
virtual bool eventFilter(QObject *watched, QEvent *event)
Definition: qobject.cpp:1484
static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint)
virtual QVariant themeHint(ThemeHint hint) const
virtual QPlatformDialogHelper * createPlatformDialogHelper(DialogType type) const
virtual bool usePlatformNativeDialog(DialogType type) const
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
constexpr int x() const noexcept
Definition: qpoint.h:155
constexpr int y() const noexcept
Definition: qpoint.h:160
The QPointer class is a template class that provides guarded pointers to QObject.
Definition: qpointer.h:54
bool isNull() const
Definition: qpointer.h:87
The QPushButton widget provides a command button.
Definition: qpushbutton.h:56
bool autoDefault
whether the push button is an auto default button
Definition: qpushbutton.h:59
void setDefault(bool)
bool isDefault() const
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
constexpr int height() const noexcept
Definition: qrect.h:266
bool contains(const QRect &r, bool proper=false) const noexcept
Definition: qrect.cpp:887
constexpr int x() const noexcept
Definition: qrect.h:212
constexpr int width() const noexcept
Definition: qrect.h:263
constexpr int y() const noexcept
Definition: qrect.h:215
The QResizeEvent class contains event parameters for resize events. \inmodule QtGui.
Definition: qevent.h:612
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition: qscreen.h:68
QRect availableGeometry
the screen's available geometry in pixels
Definition: qscreen.h:82
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:647
The QSizeGrip class provides a resize handle for resizing top-level windows.
Definition: qsizegrip.h:52
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:55
constexpr int height() const noexcept
Definition: qsize.h:160
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
bool toBool() const
Definition: qvariant.cpp:1906
static void leaveWhatsThisMode()
Definition: qwhatsthis.cpp:566
static bool inWhatsThisMode()
Definition: qwhatsthis.cpp:552
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:133
void setAttribute(Qt::WidgetAttribute, bool on=true)
Definition: qwidget.cpp:11088
QWidget * window() const
Definition: qwidget.cpp:4319
void setWindowModality(Qt::WindowModality windowModality)
Definition: qwidget.cpp:2811
void setParent(QWidget *parent)
Definition: qwidget.cpp:10512
Qt::WindowModality windowModality
which windows are blocked by the modal widget
Definition: qwidget.h:138
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:147
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:140
int width
the width of the widget excluding any window frame
Definition: qwidget.h:148
QWidget * childAt(int x, int y) const
Definition: qwidget.h:831
void move(int x, int y)
Definition: qwidget.h:913
QWidget * focusWidget() const
Definition: qwidget.cpp:6810
bool isModal() const
Definition: qwidget.h:850
QSize minimumSizeHint
the recommended minimum size for the widget
Definition: qwidget.h:183
void hide()
Definition: qwidget.cpp:8078
int height
the height of the widget excluding any window frame
Definition: qwidget.h:149
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:150
void setWindowState(Qt::WindowStates state)
Definition: qwidget.cpp:2949
int y
the y coordinate of the widget relative to its parent and including any window frame
Definition: qwidget.h:144
void show()
Definition: qwidget.cpp:7825
virtual void setVisible(bool visible)
Definition: qwidget.cpp:8198
void setScreen(QScreen *)
Definition: qwidget.cpp:2536
int x
the x coordinate of the widget relative to its parent including any window frame
Definition: qwidget.h:143
bool isEnabled() const
Definition: qwidget.h:847
QWindow * windowHandle() const
Definition: qwidget.cpp:2495
QSize sizeHint
the recommended size for the widget
Definition: qwidget.h:182
bool isRightToLeft() const
Definition: qwidget.h:450
bool enabled
whether the widget is enabled
Definition: qwidget.h:139
bool event(QEvent *event) override
Definition: qwidget.cpp:8772
bool hasFocus() const
Definition: qwidget.cpp:6430
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:174
QWidget * parentWidget() const
Definition: qwidget.h:937
bool isWindow() const
Definition: qwidget.h:844
Qt::WindowStates windowState() const
Definition: qwidget.cpp:2900
QScreen * screen() const
Definition: qwidget.cpp:2508
bool isActiveWindow
whether this widget's window is the active window
Definition: qwidget.h:173
bool isVisible() const
Definition: qwidget.h:907
bool testAttribute(Qt::WidgetAttribute) const
Definition: qwidget.h:943
bool visible
whether the widget is visible
Definition: qwidget.h:178
The QWindow class represents a window in the underlying windowing system.
Definition: qwindow.h:99
int width
the width of the window's geometry
Definition: qwindow.h:118
int height
the height of the window's geometry
Definition: qwindow.h:119
#define this
Definition: dialogs.cpp:56
double e
else opt state
[0]
Definition: qnamespace.h:55
@ WA_WState_ExplicitShowHide
Definition: qnamespace.h:360
@ WA_SetWindowModality
Definition: qnamespace.h:425
@ WA_CustomWhatsThis
Definition: qnamespace.h:338
@ WA_DontShowOnScreen
Definition: qnamespace.h:408
@ WA_Moved
Definition: qnamespace.h:334
@ WA_WState_Hidden
Definition: qnamespace.h:322
@ WA_ShowWithoutActivating
Definition: qnamespace.h:399
@ WA_ShowModal
Definition: qnamespace.h:362
@ WA_DeleteOnClose
Definition: qnamespace.h:346
WindowModality
Definition: qnamespace.h:1563
@ NonModal
Definition: qnamespace.h:1564
@ WindowModal
Definition: qnamespace.h:1565
@ NoFocus
Definition: qnamespace.h:132
@ Horizontal
Definition: qnamespace.h:124
@ Key_Return
Definition: qnamespace.h:688
@ Key_Enter
Definition: qnamespace.h:689
@ KeypadModifier
Definition: qnamespace.h:1079
WindowType
Definition: qnamespace.h:230
@ WindowType_Mask
Definition: qnamespace.h:245
@ Dialog
Definition: qnamespace.h:233
@ Sheet
Definition: qnamespace.h:234
@ TabFocusReason
Definition: qnamespace.h:1362
Definition: helper.py:1
void
Definition: png.h:1080
#define Q_UNLIKELY(x)
#define qWarning
Definition: qlogging.h:179
#define SLOT(a)
Definition: qobjectdefs.h:87
#define SIGNAL(a)
Definition: qobjectdefs.h:88
GLenum type
Definition: qopengl.h:270
GLboolean r
[2]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLfloat GLfloat f
GLint GLsizei width
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint first
struct _cl_event * event
Definition: qopenglext.h:2998
GLuint res
Definition: qopenglext.h:8867
GLdouble GLdouble GLdouble GLdouble q
Definition: qopenglext.h:259
GLfloat GLfloat p
[1]
Definition: qopenglext.h:12698
#define Q_ASSERT(cond)
Definition: qrandom.cpp:84
#define tr(X)
#define emit
Definition: qtmetamacros.h:85
Q_UNUSED(salary)
[21]
QPushButton * pushButton
QObject::connect nullptr
QFileDialog dialog(this)
[1]
QStringList list
[0]
QCommandLinkButton * pb
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent