7#include <QtCore/qloggingcategory.h>
8#include <QtGui/private/qguiapplication_p.h>
9#include <QtQuick/qquickitem.h>
10#include <QtQuick/qquickwindow.h>
12#include "widgets/qwidgetplatform_p.h"
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
35
36
37
38
39
40
41
42
43
46
47
48
49
50
51
52
53
54
56Q_STATIC_LOGGING_CATEGORY(qtLabsPlatformDialogs,
"qt.labs.platform.dialogs")
58QQuickLabsPlatformDialog::QQuickLabsPlatformDialog(QPlatformTheme::DialogType type, QObject *parent)
63 m_parentWindow(
nullptr),
65 m_modality(Qt::WindowModal),
82
83
84
85
86
87
90 return QQmlListProperty<QObject>(
this, &m_data);
94
95
96
97
98
99
100
101
104 return m_parentWindow;
109 if (m_parentWindow == window)
112 m_parentWindow = window;
113 emit parentWindowChanged();
117
118
119
120
128 if (m_title == title)
136
137
138
139
147 if (m_flags == flags)
155
156
157
158
159
160
161
162
163
171 if (m_modality == modality)
174 m_modality = modality;
175 emit modalityChanged();
179
180
181
182
183
184
187 return m_handle && m_visible;
199
200
201
202
203
204
205
206
207
208
209
217 if (m_result == result)
221 emit resultChanged();
225
226
227
228
229
230
237 m_visible = m_handle->show(m_flags, m_modality, m_parentWindow);
239 emit visibleChanged();
243
244
245
246
247
248
251 if (!m_handle || !m_visible)
257 emit visibleChanged();
261
262
263
264
265
266
273
274
275
276
277
278
285
286
287
288
289
290
315 return object->metaObject()->className() + qstrlen(
"QQuickLabsPlatform");
321 if (useNativeDialog())
322 m_handle = QGuiApplicationPrivate::platformTheme()->createPlatformDialogHelper(m_type);
324 m_handle = QWidgetPlatform::createDialog(m_type,
this);
325 qCDebug(qtLabsPlatformDialogs) << qmlTypeName(
this) <<
"->" << m_handle;
328 connect(m_handle, &QPlatformDialogHelper::accept,
this, &QQuickLabsPlatformDialog::accept);
329 connect(m_handle, &QPlatformDialogHelper::reject,
this, &QQuickLabsPlatformDialog::reject);
343 return !QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
344 && QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(m_type);
364 QObject *obj = parent();
366 QWindow *window = qobject_cast<QWindow *>(obj);
369 QQuickItem *item = qobject_cast<QQuickItem *>(obj);
370 if (item && item->window())
371 return item->window();
379#include "moc_qquicklabsplatformdialog_p.cpp"