diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-11-23 12:04:01 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-14 21:49:33 +0100 |
commit | 56c4ddfdf62ff6b71ce3df680bdaca01012e13f4 (patch) | |
tree | 5777f621303392efa9852f982e52a09a9e44e7e0 /src/widgets/dialogs/qdialog.cpp | |
parent | f86007175d7d9d592e9cf6499704ad4f17944ce4 (diff) |
QPlatformDialogHelpers: Reduce dependency on QDialog.
For each QDialog-derived class, introduce a Q[X]Options class
containing the options of the dialog. An instance is shared
between the QDialog (or dialog desktop component) and the
helper.
Change-Id: Ibabf508a4b9eaea25615638a47a4c1b8f93c019e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/widgets/dialogs/qdialog.cpp')
-rw-r--r-- | src/widgets/dialogs/qdialog.cpp | 25 |
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; } |