summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-04-30 14:26:47 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-09 13:42:03 +0200
commitab947649eb984b006a856d41476e615dc901bcf7 (patch)
tree9edee6b47b64ae8c89941c0d01db982973af86d3 /src/widgets
parent9f2f7a8f7270411677f2074fdf635f8b4b94d325 (diff)
QPA: Cleanup native dialog modal execution
Remove the _q_platformRunNativeAppModalPanel() function, together with the launchNativeAppModalPanel() signal and emitLaunchNativeAppModalPanel() slot, which were previously used to run the modal loop inside the QDialog::exec() loop. This trick isn't necessary anymore, so remove the mechanism and code related to it. Rename QPlatformDialogHelper::platformNativeDialogModalHelp() to exec_sys(). This function is now responsible for both showing the native dialog and running the modal loop. QDialog:exec() now calls this function if a native dialog is in use (it does not call QEventLoop::exec() anymore). The dialogResultCode_sys() function was unused, so it has also been removed. This commit also removes some unused private slots that were left over from the port to QPA. Note that the comments in the Cocoa plugin are still valid and relevant, but this commit does not fix the scenarios mentioned. This will be done in a future commit. The Windows plugin needs minor changes. The QueuedConnections to accept() and reject() cause the deliver to come too late, resulting in crashes, hence the change to AutoConnection (which ends up being a DirectConnection). Change-Id: Ifc90325c945ca78737e60bf331929f03ecc52e0a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qcolordialog.h1
-rw-r--r--src/widgets/dialogs/qdialog.cpp22
-rw-r--r--src/widgets/dialogs/qdialog.h1
-rw-r--r--src/widgets/dialogs/qdialog_p.h1
-rw-r--r--src/widgets/dialogs/qfiledialog.h1
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h10
-rw-r--r--src/widgets/dialogs/qfontdialog.h3
7 files changed, 7 insertions, 32 deletions
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 1daead3879..9e8e56e927 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -124,7 +124,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_newColorTypedIn(QRgb rgb))
Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int))
Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int))
- Q_PRIVATE_SLOT(d_func(), void _q_platformRunNativeAppModalPanel())
friend class QColorShower;
};
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 44463b8d32..29a8576e6b 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -88,8 +88,6 @@ QPlatformDialogHelper *QDialogPrivate::platformHelper() const
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);
}
}
@@ -118,13 +116,6 @@ 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())
@@ -535,13 +526,14 @@ int QDialog::exec()
}
show();
- if (d->nativeDialogInUse)
- d->platformHelper()->platformNativeDialogModalHelp();
-
- QEventLoop eventLoop;
- d->eventLoop = &eventLoop;
QPointer<QDialog> guard = this;
- (void) eventLoop.exec(QEventLoop::DialogExec);
+ if (d->nativeDialogInUse) {
+ d->platformHelper()->exec_sys();
+ } else {
+ QEventLoop eventLoop;
+ d->eventLoop = &eventLoop;
+ (void) eventLoop.exec(QEventLoop::DialogExec);
+ }
if (guard.isNull())
return QDialog::Rejected;
d->eventLoop = 0;
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index f20ff46d41..29a5a724d5 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -117,7 +117,6 @@ protected:
private:
Q_DECLARE_PRIVATE(QDialog)
Q_DISABLE_COPY(QDialog)
- Q_PRIVATE_SLOT(d_func(), void _q_platformRunNativeAppModalPanel())
#ifdef Q_OS_WINCE_WM
Q_PRIVATE_SLOT(d_func(), void _q_doneAction())
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 7b02f359dd..3b8a5edb0f 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -79,7 +79,6 @@ public:
nativeDialogInUse(false), m_platformHelper(0), m_platformHelperCreated(false)
{}
~QDialogPrivate() { delete m_platformHelper; }
- void _q_platformRunNativeAppModalPanel();
QWindow *parentWindow() const;
bool setNativeDialogVisible(bool visible);
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index c5298b1227..ee4ae72519 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -252,7 +252,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex & parent))
Q_PRIVATE_SLOT(d_func(), void _q_fileRenamed(const QString &path,
const QString oldName, const QString newName))
- Q_PRIVATE_SLOT(d_func(), void _q_platformRunNativeAppModalPanel())
friend class QPlatformDialogHelper;
};
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index 4283842b1d..0132d4ba6f 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -244,7 +244,6 @@ public:
// dialog. Returning false means that a non-native dialog must be
// used instead.
bool canBeNativeDialog();
- QDialog::DialogCode dialogResultCode_sys();
void setDirectory_sys(const QString &directory);
QString directory_sys() const;
@@ -346,15 +345,6 @@ inline QString QFileDialogPrivate::rootPath() const {
return model->rootPath();
}
-inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys()
-{
- QDialog::DialogCode result = QDialog::Rejected;
- if (QPlatformDialogHelper *helper = platformHelper())
- if (helper->dialogResultCode_sys() == QPlatformDialogHelper::Accepted)
- result = QDialog::Accepted;
- return result;
-}
-
inline void QFileDialogPrivate::setDirectory_sys(const QString &directory)
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index c5f654a50a..979293c234 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -118,9 +118,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int))
Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int))
Q_PRIVATE_SLOT(d_func(), void _q_updateSample())
-#if defined(Q_WS_MAC)
- Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel())
-#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)