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
qdialog_p.h
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#ifndef QDIALOG_P_H
5#define QDIALOG_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "private/qwidget_p.h"
20#include "QtCore/qeventloop.h"
21#include "QtCore/qpointer.h"
22#include "QtWidgets/qdialog.h"
23#if QT_CONFIG(pushbutton)
24#include "QtWidgets/qpushbutton.h"
25#endif
26#include <qpa/qplatformdialoghelper.h>
27
29
31
32class QSizeGrip;
33
34class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate
35{
36 Q_DECLARE_PUBLIC(QDialog)
37public:
38
40 :
41#if QT_CONFIG(pushbutton)
42 mainDef(nullptr),
43#endif
44 orientation(Qt::Horizontal),extension(nullptr), doShowExtension(false),
45#if QT_CONFIG(sizegrip)
46 resizer(nullptr),
47 sizeGripEnabled(false),
48#endif
49 rescode(0), resetModalityTo(-1), wasModalitySet(true), eventLoop(nullptr),
50 nativeDialogInUse(false), m_platformHelper(nullptr), m_platformHelperCreated(false)
51 {}
53
54 virtual void setVisible(bool visible);
55
56 QWindow *transientParentWindow() const;
57 bool setNativeDialogVisible(bool visible);
59
60#if QT_CONFIG(pushbutton)
61 QPointer<QPushButton> mainDef;
62#endif
66 QSize size, min, max;
67#if QT_CONFIG(sizegrip)
68 QSizeGrip *resizer;
69 bool sizeGripEnabled;
70#endif
72
73#if QT_CONFIG(pushbutton)
74 void setDefault(QPushButton *);
75 void setMainDefault(QPushButton *);
76 void hideDefault();
77#endif
78 void resetModalitySetByOpen();
79
83
84 QPointer<QEventLoop> eventLoop;
85
87 QPlatformDialogHelper *platformHelper() const;
88 virtual bool canBeNativeDialog() const;
89
90 void close(int resultCode);
91
92protected:
93 virtual int dialogCode() const { return rescode; }
94
95private:
99
100 mutable QPlatformDialogHelper *m_platformHelper;
101 mutable bool m_platformHelperCreated;
102};
103
104template <typename T>
106 QPointer<T> o;
107public:
108 Q_NODISCARD_CTOR explicit QAutoPointer(T *t) noexcept : o(t) {}
109 ~QAutoPointer() { delete o; }
110
111 T *operator->() const noexcept { return get(); }
112 T *get() const noexcept { return o; }
113 T &operator*() const { return *get(); }
114 explicit operator bool() const noexcept { return !o.isNull(); }
115 bool operator!() const noexcept { return !o; }
116private:
117 Q_DISABLE_COPY(QAutoPointer);
118};
119
121
122#endif // QDIALOG_P_H
T & operator*() const
Definition qdialog_p.h:113
bool operator!() const noexcept
Definition qdialog_p.h:115
T * get() const noexcept
Definition qdialog_p.h:112
T * operator->() const noexcept
Definition qdialog_p.h:111
Q_NODISCARD_CTOR QAutoPointer(T *t) noexcept
Definition qdialog_p.h:108
QWidget * extension
Definition qdialog_p.h:64
virtual void initHelper(QPlatformDialogHelper *)
Definition qdialog_p.h:96
virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *)
Definition qdialog_p.h:98
bool wasModalitySet
Definition qdialog_p.h:82
QPoint lastRMBPress
Definition qdialog_p.h:71
int resetModalityTo
Definition qdialog_p.h:81
QPointer< QEventLoop > eventLoop
Definition qdialog_p.h:84
bool nativeDialogInUse
Definition qdialog_p.h:86
bool doShowExtension
Definition qdialog_p.h:65
virtual void helperPrepareShow(QPlatformDialogHelper *)
Definition qdialog_p.h:97
Qt::Orientation orientation
Definition qdialog_p.h:63
virtual int dialogCode() const
Definition qdialog_p.h:93
The QDialog class is the base class of dialog windows.
Definition qdialog.h:19
DialogCode
The value returned by a modal dialog.
Definition qdialog.h:30
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
StyleHint
This enum type specifies platform-specific style hints.
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
The QSizeGrip class provides a resize handle for resizing top-level windows.
Definition qsizegrip.h:16
\inmodule QtCore
Definition qsize.h:25
\inmodule QtCore
Definition qvariant.h:65
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
\inmodule QtGui
Definition qwindow.h:63
void extension()
[6]
Definition dialogs.cpp:230
Combined button and popup list for selecting options.
Definition qcompare.h:63
Orientation
Definition qnamespace.h:98
#define Q_NODISCARD_CTOR
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble t
Definition qopenglext.h:243
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define QT_CONFIG(feature)
#define QT_REQUIRE_CONFIG(feature)
if(qFloatDistance(a, b)<(1<< 7))
[0]
QObject::connect nullptr
QFileDialog dialog(this)
[1]