Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QDIALOG_P_H
6#define QDIALOG_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtWidgets/private/qtwidgetsglobal_p.h>
20#include "private/qwidget_p.h"
21#include "QtCore/qeventloop.h"
22#include "QtCore/qpointer.h"
23#include "QtWidgets/qdialog.h"
24#if QT_CONFIG(pushbutton)
25#include "QtWidgets/qpushbutton.h"
26#endif
27#include <qpa/qplatformdialoghelper.h>
28
29QT_REQUIRE_CONFIG(dialog);
30
31QT_BEGIN_NAMESPACE
32
33class QSizeGrip;
34
35class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate
36{
37 Q_DECLARE_PUBLIC(QDialog)
38public:
39
40 QDialogPrivate()
41 :
42#if QT_CONFIG(pushbutton)
43 mainDef(nullptr),
44#endif
45 orientation(Qt::Horizontal),extension(nullptr), doShowExtension(false),
46#if QT_CONFIG(sizegrip)
47 resizer(nullptr),
48 sizeGripEnabled(false),
49#endif
50 rescode(0), resetModalityTo(-1), wasModalitySet(true), eventLoop(nullptr),
51 nativeDialogInUse(false), m_platformHelper(nullptr), m_platformHelperCreated(false)
52 {}
53 ~QDialogPrivate();
54
55 void setVisible(bool visible) override;
56
57 QWindow *transientParentWindow() const;
58 bool setNativeDialogVisible(bool visible);
59 QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const;
60
61#if QT_CONFIG(pushbutton)
62 QPointer<QPushButton> mainDef;
63#endif
64 Qt::Orientation orientation;
65 QWidget *extension;
66 bool doShowExtension;
67 QSize size, min, max;
68#if QT_CONFIG(sizegrip)
69 QSizeGrip *resizer;
70 bool sizeGripEnabled;
71#endif
72 QPoint lastRMBPress;
73
74#if QT_CONFIG(pushbutton)
75 void setDefault(QPushButton *);
76 void setMainDefault(QPushButton *);
77 void hideDefault();
78#endif
79 void resetModalitySetByOpen();
80
81 int rescode;
82 int resetModalityTo;
83 bool wasModalitySet;
84
85 QPointer<QEventLoop> eventLoop;
86
87 bool nativeDialogInUse;
88 QPlatformDialogHelper *platformHelper() const;
89 virtual bool canBeNativeDialog() const;
90
91 void close(int resultCode);
92
93 void recreate() override;
94
95protected:
96 virtual int dialogCode() const { return rescode; }
97
98private:
99 virtual void initHelper(QPlatformDialogHelper *) {}
100 virtual void helperPrepareShow(QPlatformDialogHelper *) {}
101 virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) {}
102
103 mutable QPlatformDialogHelper *m_platformHelper;
104 mutable bool m_platformHelperCreated;
105};
106
107template <typename T>
109 QPointer<T> o;
110public:
113 Q_NODISCARD_CTOR explicit QAutoPointer(T *t) noexcept : o(t) {}
115 : o{std::exchange(other.o, nullptr)}
116 {}
117 ~QAutoPointer() { delete o; }
118
119 void swap(QAutoPointer &other) noexcept { o.swap(other.o); }
120 friend void swap(QAutoPointer &lhs, QAutoPointer &rhs) noexcept { lhs.swap(rhs); }
122
123 T *operator->() const noexcept { return get(); }
124 T *get() const noexcept { return o; }
125 T &operator*() const { return *get(); }
126 explicit operator bool() const noexcept { return !o.isNull(); }
127 bool operator!() const noexcept { return !o; }
128private:
130};
131
132QT_END_NAMESPACE
133
134#endif // QDIALOG_P_H
operator bool() const noexcept
Definition qdialog_p.h:126
T & operator*() const
Definition qdialog_p.h:125
bool operator!() const noexcept
Definition qdialog_p.h:127
T * get() const noexcept
Definition qdialog_p.h:124
T * operator->() const noexcept
Definition qdialog_p.h:123
void swap(QAutoPointer &other) noexcept
Definition qdialog_p.h:119
friend void swap(QAutoPointer &lhs, QAutoPointer &rhs) noexcept
Definition qdialog_p.h:120
The QCheckBox widget provides a checkbox with a text label.
Definition qcheckbox.h:20
void helperPrepareShow(QPlatformDialogHelper *) override
void initHelper(QPlatformDialogHelper *) override
bool isMessageToBeShown(const QString &message, const QString &type) const
std::queue< Message > pending
void setVisible(bool) override
The QErrorMessage class provides an error message display dialog.
static QString msgType2i18nString(QtMsgType t)
static bool metFatal
static void deleteStaticcQErrorMessage()
static QErrorMessage * qtMessageHandler
static QtMessageHandler originalMessageHandler
static void jump(QtMsgType t, const QMessageLogContext &context, const QString &m)
QT_REQUIRE_CONFIG(errormessage)
QT_REQUIRE_CONFIG(liburing)