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
93protected:
94 virtual int dialogCode() const { return rescode; }
95
96private:
97 virtual void initHelper(QPlatformDialogHelper *) {}
98 virtual void helperPrepareShow(QPlatformDialogHelper *) {}
99 virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) {}
100
101 mutable QPlatformDialogHelper *m_platformHelper;
102 mutable bool m_platformHelperCreated;
103};
104
105template <typename T>
107 QPointer<T> o;
108public:
109 Q_NODISCARD_CTOR explicit QAutoPointer(T *t) noexcept : o(t) {}
110 ~QAutoPointer() { delete o; }
111
112 T *operator->() const noexcept { return get(); }
113 T *get() const noexcept { return o; }
114 T &operator*() const { return *get(); }
115 explicit operator bool() const noexcept { return !o.isNull(); }
116 bool operator!() const noexcept { return !o; }
117private:
119};
120
121QT_END_NAMESPACE
122
123#endif // QDIALOG_P_H
operator bool() const noexcept
Definition qdialog_p.h:115
T & operator*() const
Definition qdialog_p.h:114
bool operator!() const noexcept
Definition qdialog_p.h:116
T * get() const noexcept
Definition qdialog_p.h:113
T * operator->() const noexcept
Definition qdialog_p.h:112
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(thread)