From 661c3701f4731283a3f1062e4a8c8c02fb01e3c6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 16 Jan 2013 16:44:25 +0100 Subject: Fix Windows native file dialogs for use with QtQuick. - Correct modality check. - Allow for properties to be set if there is no native dialog. - Make dialog thread for non-modal call back into dialog helper for exec(). - Introduce QWindowsFileDialogSharedData to contain data to be cached while no native dialog exists and to be updated by the change notifications of the IFileDialogEvent interface to avoid querying the dialog results after the dialog has closed. Reduce virtual methods of QWindowsNativeFileDialogBase accordingly. This also fixes a bug in the previous implementation causing the directory not to reported back since the native API would not return the directory after closing the dialog. - Support nonmodal native dialogs when constructed on a QQuickWindow. - Delete native dialogs after exec as QtQuick keeps the dialog instances around. Change-Id: Id1169d6657d9476afe12fb9909c36cbd03aa2a40 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann Reviewed-by: Shawn Rutledge --- src/plugins/platforms/windows/qwindowsdialoghelpers.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsdialoghelpers.h') diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index c656f72d6e..9ec93f1b4c 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -65,6 +65,7 @@ template class QWindowsDialogHelperBase : public BaseClass { public: + ~QWindowsDialogHelperBase() { deleteNativeDialog(); } virtual void exec(); virtual bool show(Qt::WindowFlags windowFlags, @@ -73,12 +74,13 @@ public: virtual void hide(); virtual QVariant styleHint(QPlatformDialogHelper::StyleHint) const; - virtual bool supportsNonModalDialog() const { return true; } + virtual bool supportsNonModalDialog(const QWindow * /* parent */ = 0) const { return true; } protected: QWindowsDialogHelperBase(); - ~QWindowsDialogHelperBase(); QWindowsNativeDialogBase *nativeDialog() const; + inline bool hasNativeDialog() const { return m_nativeDialog; } + void deleteNativeDialog(); private: virtual QWindowsNativeDialogBase *createNativeDialog() = 0; -- cgit v1.2.3 From 779195343f14fcbc6c12bee0948f6a20ecfec852 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 22 Jan 2013 10:58:25 +0100 Subject: Windows: Fix modal dialogs for declarative. Make it possible to show a modal dialog by just calling show(). Start an idle timer, which will start the dialog thread. This timer is stopped in exec(). Change-Id: I8f7352bf577b09a19be7df4484e0077bb1aa46ab Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsdialoghelpers.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/plugins/platforms/windows/qwindowsdialoghelpers.h') diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index a46caf0e1e..7884f398f3 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -81,13 +81,17 @@ protected: QWindowsNativeDialogBase *nativeDialog() const; inline bool hasNativeDialog() const { return m_nativeDialog; } void deleteNativeDialog(); + void timerEvent(QTimerEvent *); private: virtual QWindowsNativeDialogBase *createNativeDialog() = 0; inline QWindowsNativeDialogBase *ensureNativeDialog(); + inline void startDialogThread(); + inline void stopTimer(); QWindowsNativeDialogBase *m_nativeDialog; HWND m_ownerWindow; + int m_timerId; }; QT_END_NAMESPACE -- cgit v1.2.3