summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs/qdialog.cpp')
-rw-r--r--src/widgets/dialogs/qdialog.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 363d3bf592..4170530ff7 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -66,10 +66,16 @@ QPlatformDialogHelper *QDialogPrivate::platformHelper() const
if (!m_platformHelperCreated) {
QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
m_platformHelperCreated = true;
+ QDialog *dialog = ncThis->q_func();
m_platformHelper = QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(ncThis->q_func());
- if (m_platformHelper)
+ ->createPlatformDialogHelper(dialog);
+ if (m_platformHelper) {
+ QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept()));
+ QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject()));
+ QObject::connect(m_platformHelper, SIGNAL(launchNativeAppModalPanel()),
+ dialog, SLOT(_q_platformRunNativeAppModalPanel()));
ncThis->initHelper(m_platformHelper);
+ }
}
return m_platformHelper;
}
@@ -85,7 +91,11 @@ bool QDialogPrivate::setNativeDialogVisible(bool visible)
{
if (QPlatformDialogHelper *helper = platformHelper()) {
if (visible) {
- nativeDialogInUse = helper->show_sys(parentWindow());
+ helperPrepareShow(helper);
+ QPlatformDialogHelper::ShowFlags flags(0);
+ if (q_func()->isModal())
+ flags |= QPlatformDialogHelper::ShowModal;
+ nativeDialogInUse = helper->show_sys(flags, q_func()->windowFlags(), parentWindow());
} else {
helper->hide_sys();
}
@@ -93,6 +103,13 @@ bool QDialogPrivate::setNativeDialogVisible(bool visible)
return nativeDialogInUse;
}
+void QDialogPrivate::_q_platformRunNativeAppModalPanel()
+{
+ if (nativeDialogInUse)
+ platformHelper()->_q_platformRunNativeAppModalPanel();
+}
+
+
QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
{
if (const QPlatformDialogHelper *helper = platformHelper())
@@ -505,6 +522,8 @@ int QDialog::exec()
int res = result();
if (deleteOnClose)
delete this;
+ if (d->nativeDialogInUse)
+ d->helperDone(static_cast<QDialog::DialogCode>(res), d->platformHelper());
return res;
}