diff options
| author | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-03-02 12:21:58 +0100 |
|---|---|---|
| committer | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-03-18 09:20:19 +0000 |
| commit | cbd066616b0b24fb8003323b467a3269b7edb602 (patch) | |
| tree | 930b27603f5c3644a88d1cabfa4c59d44e07cae1 /src/dialogs/plugin.cpp | |
| parent | 906e1e32ec4692ea2e3e281c6c3d7ebf7aa9d7ef (diff) | |
Dialogs: implement QML backup support for native file dialog
QtQuickAbstractDialog will fall back to use QML version of a dialog
if a dialog helper returns false on show. We will utilize this for
file dialogs by letting a platform be selective about when to show
a native dialog. A platform can use this to e.g show specific native
dialogs for certain dialog configurations, and otherwise return false
to signal that the caller should fall back to use the QML/widgets version.
This patch will change the class structure to the following:
QQAbstractDialog <- QQAbstractFileDialog <- QQFileDialog <- QQPlatformFileDialog
and then register QQPlatformFileDialog as the abstract dialog that
DefaultFileDialog.qml intantiates. This means that a file dialog will have
QML contents ready for backup if the platform file dialog fails.
Change-Id: I65d0fb9c49c501501e441873d6b858475fef5522
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/dialogs/plugin.cpp')
| -rw-r--r-- | src/dialogs/plugin.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dialogs/plugin.cpp b/src/dialogs/plugin.cpp index 0f0c61275..62c48e0c7 100644 --- a/src/dialogs/plugin.cpp +++ b/src/dialogs/plugin.cpp @@ -134,8 +134,11 @@ public: // FileDialog #ifndef PURE_QML_ONLY + // We register the QML version of the filedialog, even if the platform has native support. + // QQuickAbstractDialog::setVisible() will check if a native dialog can be shown, and + // only fall back to use the QML version if showing fails. if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog)) - qmlRegisterType<QQuickPlatformFileDialog>(uri, 1, 0, "FileDialog"); + registerQmlImplementation<QQuickPlatformFileDialog>(qmlDir, "FileDialog", uri, 1, 0); else #endif registerWidgetOrQmlImplementation<QQuickFileDialog>(widgetsDir, qmlDir, "FileDialog", uri, hasTopLevelWindows, 1, 0); |
