4#include <QtWidgets/qtwidgetsglobal.h>
5#if QT_CONFIG(colordialog)
8#if QT_CONFIG(fontdialog)
11#if QT_CONFIG(filedialog)
18#if QT_CONFIG(sizegrip)
21#if QT_CONFIG(whatsthis)
28#if QT_CONFIG(messagebox)
31#if QT_CONFIG(errormessage)
34#include <qpa/qplatformtheme.h>
35#include "private/qdialog_p.h"
36#include "private/qguiapplication_p.h"
37#if QT_CONFIG(accessibility)
45#if QT_CONFIG(filedialog)
46 if (qobject_cast<const QFileDialog *>(
dialog))
49#if QT_CONFIG(colordialog)
50 if (qobject_cast<const QColorDialog *>(
dialog))
53#if QT_CONFIG(fontdialog)
54 if (qobject_cast<const QFontDialog *>(
dialog))
57#if QT_CONFIG(messagebox)
58 if (qobject_cast<const QMessageBox *>(
dialog))
61#if QT_CONFIG(errormessage)
62 if (qobject_cast<const QErrorMessage *>(
dialog))
65#if !QT_CONFIG(filedialog) && !QT_CONFIG(colordialog) && !QT_CONFIG(fontdialog) && \
66 !QT_CONFIG(messagebox) && !QT_CONFIG(errormessage)
74 delete m_platformHelper;
82 m_platformHelperCreated =
true;
89 if (m_platformHelper) {
92 ncThis->initHelper(m_platformHelper);
96 return m_platformHelper;
122 q->setResult(resultCode);
124 if (!
data.is_closing) {
128 struct CloseEventEater :
QObject
139 q->installEventFilter(&closeEventEater);
156 return parent->windowHandle();
157 else if (
q->windowHandle())
158 return q->windowHandle()->transientParent();
179 return helper->styleHint(
hint);
368 f | ((
f &
Qt::WindowType_Mask) == 0 ?
Qt::Dialog :
Qt::WindowType(0)))
377 :
QWidget(dd, parent,
f | ((
f &
Qt::WindowType_Mask) == 0 ?
Qt::Dialog :
Qt::WindowType(0)))
403#if QT_CONFIG(pushbutton)
407 bool hasMain =
false;
419 mainDef->setDefault(
true);
440void QDialogPrivate::hideDefault()
509 d->resetModalityTo = modality;
548 qWarning(
"QDialog::exec: Recursive call detected");
555 d->resetModalitySetByOpen();
563 QPointer<QDialog> guard =
this;
564 if (
d->nativeDialogInUse) {
565 d->platformHelper()->exec();
568 d->eventLoop = &eventLoop;
573 d->eventLoop =
nullptr;
578 if (
d->nativeDialogInUse)
604 QPointer<QDialog> guard(
this);
612 int dialogCode =
d->dialogCode();
654#ifndef QT_NO_CONTEXTMENU
658#if !QT_CONFIG(whatsthis) || !QT_CONFIG(menu)
668 w =
w->isWindow() ?
nullptr :
w->parentWidget();
670 QPointer<QMenu>
p =
new QMenu(
this);
674 w->mapToGlobal(
w->rect().center()));
686#ifndef QT_NO_SHORTCUT
696#if QT_CONFIG(pushbutton)
699 QList<QPushButton*>
list = findChildren<QPushButton*>();
723#if QT_CONFIG(whatsthis)
728 QPointer<QObject> that =
this;
768 if (dontBlockWindows) {
769 oldModality =
q->windowModality();
775 q->QWidget::setVisible(visible);
794#if QT_CONFIG(pushbutton)
799 if (
first != mainDef && qobject_cast<QPushButton*>(
first))
802 if (!mainDef &&
q->isWindow()) {
804 while ((
w =
w->nextInFocusChain()) != fw) {
819#if QT_CONFIG(accessibility)
820 QAccessibleEvent
event(
q, QAccessible::DialogStart);
821 QAccessible::updateAccessibility(&
event);
826#if QT_CONFIG(accessibility)
827 if (
q->isVisible()) {
828 QAccessibleEvent
event(
q, QAccessible::DialogEnd);
829 QAccessible::updateAccessibility(&
event);
834 q->QWidget::setVisible(visible);
839 if (dontBlockWindows) {
840 q->setWindowModality(oldModality);
844#if QT_CONFIG(pushbutton)
846 if (mainDef &&
q->isActiveWindow()
873 int extraw = 0, extrah = 0;
874 const QWindow *parentWindow =
nullptr;
878 parentWindow =
d->transientParentWindow();
884 else if (parentWindow)
885 scrn = parentWindow->screen();
894 for (
int i = 0; (extraw == 0 || extrah == 0) &&
i <
list.
size(); ++
i) {
897 int framew = current->
geometry().
x() - current->
x();
898 int frameh = current->
geometry().
y() - current->
y();
900 extraw =
qMax(extraw, framew);
901 extrah =
qMax(extrah, frameh);
907 if (extraw == 0 || extrah == 0 || extraw >= 10 || extrah >= 40) {
916 if (
w->windowHandle() && qvariant_cast<WId>(
w->windowHandle()->property(
"_q_embedded_native_parent_handle")))
919 pp =
w->mapToGlobal(
QPoint(0,0));
921 pp.y() +
w->height()/ 2);
922 }
else if (parentWindow) {
929 p =
QPoint(desk.x() + desk.width()/2, desk.y() + desk.height()/2);
937 if (
p.x() + extraw +
width() > desk.x() + desk.width())
938 p.setX(desk.x() + desk.width() -
width() - extraw);
939 if (
p.x() < desk.x())
942 if (
p.y() + extrah +
height() > desk.y() + desk.height())
943 p.setY(desk.y() + desk.height() -
height() - extrah);
944 if (
p.y() < desk.y())
1012#if QT_CONFIG(sizegrip)
1014 return !!
d->resizer;
1023#if !QT_CONFIG(sizegrip)
1027#if QT_CONFIG(sizegrip)
1036 d->resizer->resize(
d->resizer->sizeHint());
1041 d->resizer->raise();
1045 d->resizer =
nullptr;
1056#if QT_CONFIG(sizegrip)
1063 d->resizer->raise();
1111#include "moc_qdialog.cpp"
The QAction class provides an abstraction for user commands that can be added to different user inter...
QVariant data() const
Returns the user data as set in QAction::setData.
static QWidgetList topLevelWidgets()
Returns a list of the top-level widgets (windows) in the application.
The QCloseEvent class contains parameters that describe a close event.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
static void setPos(int x, int y)
Moves the cursor (hot spot) of the primary screen to the global screen position (x,...
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
bool setNativeDialogVisible(bool visible)
virtual void setVisible(bool visible)
QPlatformDialogHelper * platformHelper() const
virtual bool canBeNativeDialog() const
QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const
void resetModalitySetByOpen()
QPointer< QEventLoop > eventLoop
virtual void helperPrepareShow(QPlatformDialogHelper *)
QWindow * transientParentWindow() const
The QDialog class is the base class of dialog windows.
void closeEvent(QCloseEvent *) override
\reimp
QSize sizeHint() const override
\reimp
bool isSizeGripEnabled() const
void finished(int result)
bool eventFilter(QObject *, QEvent *) override
\reimp
void setSizeGripEnabled(bool)
virtual void reject()
Hides the modal dialog and sets the result code to Rejected.
void setResult(int r)
Sets the modal dialog's result code to i.
~QDialog()
Destroys the QDialog, deleting all its children.
void keyPressEvent(QKeyEvent *) override
\reimp
virtual int exec()
Shows the dialog as a \l{QDialog::Modal Dialogs}{modal dialog}, blocking until the user closes it.
QSize minimumSizeHint() const override
\reimp
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
DialogCode
The value returned by a modal dialog.
void setModal(bool modal)
void resizeEvent(QResizeEvent *) override
\reimp
void showEvent(QShowEvent *) override
\reimp
void contextMenuEvent(QContextMenuEvent *) override
\reimp
QDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructs a dialog with parent parent.
virtual void done(int)
Closes the dialog and sets its result code to r.
void adjustPosition(QWidget *)
void setVisible(bool visible) override
\reimp
bool modal
whether show() should pop up the dialog as modal or modeless
virtual void accept()
Hides the modal dialog and sets the result code to Accepted.
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
void exit(int returnCode=0)
Tells the event loop to exit with a return code.
Type type() const
Returns the event type.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
The QFocusEvent class contains event parameters for widget focus events.
static QPlatformTheme * platformTheme()
QScreen * primaryScreen
the primary (or default) screen of the application.
static QScreen * screenAt(const QPoint &point)
Returns the screen at point, or \nullptr if outside of any screen.
The QHelpEvent class provides an event that is used to request helpful information about a particular...
The QKeyEvent class describes a key event.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
Q_INVOKABLE QObject(QObject *parent=nullptr)
Constructs an object with parent object parent.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr QPoint bottomLeft() const noexcept
Returns the position of the rectangle's bottom-left corner.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QPoint bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
The QResizeEvent class contains event parameters for resize events.
The QScreen class is used to query screen properties. \inmodule QtGui.
QRect availableGeometry
the screen's available geometry in pixels
The QShowEvent class provides an event that is sent when a widget is shown.
The QSizeGrip class provides a resize handle for resizing top-level windows.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
static void leaveWhatsThisMode()
If the user interface is in "What's This?" mode, this function switches back to normal mode; otherwis...
static bool inWhatsThisMode()
Returns true if the user interface is in "What's This?" mode; otherwise returns false.
int width
the width of the window's geometry
int height
the height of the window's geometry
Combined button and popup list for selecting options.
@ WA_WState_ExplicitShowHide
@ WA_ShowWithoutActivating
@ AA_DontUseNativeDialogs
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
static QT_BEGIN_NAMESPACE int themeDialogType(const QDialog *dialog)
constexpr const T & qMax(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLdouble GLdouble GLdouble GLdouble q
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QFileDialog dialog(this)
[1]