summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-05-09 13:55:25 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-10 06:56:20 +0200
commit5f43422ddf38e48f56b2ef39ee19bec2cb430ac4 (patch)
treeb8be9f5168345b2ff366881e0bc31f6f39fc4d8d /src/widgets
parentd223b30c42a9a8d42a8dd35b2d93615e646b4f1e (diff)
qpa: Remove QPlatformDialogHelper::deleteNativeDialog()
This function isn't really needed. The QDialogPrivate destructor deletes the platform helper, so the QDialog destructor does not need to do it. Subclasses of QPlatformDialogHelper are now responsible for deleting any native resources they create. The one place in QFileDialog that needs to recreate the native dialog can simply recreate the helper. QDialogPrivate::deleteNativeDialog() now becomes QDialogPrivate::deletePlatformHelper(), which resets all state to allow the platform helper to be recreated. Change-Id: I58adfe8801e02e63b3cb4a9a3a0b8cb5b3c7b161 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qdialog.cpp11
-rw-r--r--src/widgets/dialogs/qdialog_p.h2
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp2
3 files changed, 7 insertions, 8 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index b0cc35340d..f3e0773eac 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -123,12 +123,12 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
return QPlatformDialogHelper::defaultStyleHint(hint);
}
-void QDialogPrivate::deleteNativeDialog()
+void QDialogPrivate::deletePlatformHelper()
{
- if (QPlatformDialogHelper *helper = platformHelper()) {
- helper->deleteNativeDialog();
- nativeDialogInUse = false;
- }
+ delete m_platformHelper;
+ m_platformHelper = 0;
+ m_platformHelperCreated = false;
+ nativeDialogInUse = false;
}
/*!
@@ -335,7 +335,6 @@ QDialog::~QDialog()
} QT_CATCH(...) {
// we're in the destructor - just swallow the exception
}
- d->deleteNativeDialog();
}
/*!
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 3b8a5edb0f..34d5c551fd 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -83,7 +83,7 @@ public:
QWindow *parentWindow() const;
bool setNativeDialogVisible(bool visible);
QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const;
- void deleteNativeDialog();
+ void deletePlatformHelper();
QPointer<QPushButton> mainDef;
Qt::Orientation orientation;
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 15a85c98d9..057728e254 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1371,7 +1371,7 @@ void QFileDialog::setAcceptMode(QFileDialog::AcceptMode mode)
}
d->retranslateWindowTitle();
// we need to recreate the native dialog when changing the AcceptMode
- d->deleteNativeDialog();
+ d->deletePlatformHelper();
// clear WA_DontShowOnScreen so that d->canBeNativeDialog() doesn't return false incorrectly
setAttribute(Qt::WA_DontShowOnScreen, false);
}