1 | // Copyright (C) 2021 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "qquickdialogimplfactory_p.h" |
5 | |
6 | #include <QtCore/qloggingcategory.h> |
7 | |
8 | #include <QtQuick/private/qtquickglobal_p.h> |
9 | #if QT_CONFIG(quick_listview) |
10 | #include "qquickplatformfiledialog_p.h" |
11 | #include "qquickplatformfolderdialog_p.h" |
12 | #include "qquickplatformfontdialog_p.h" |
13 | #endif |
14 | #include "qquickplatformcolordialog_p.h" |
15 | #include "qquickplatformmessagedialog_p.h" |
16 | |
17 | QT_BEGIN_NAMESPACE |
18 | |
19 | /*! |
20 | \internal |
21 | |
22 | Creates concrete QML-based dialogs. |
23 | */ |
24 | |
25 | Q_LOGGING_CATEGORY(lcQuickDialogImplFactory, "qt.quick.dialogs.quickdialogimplfactory") |
26 | |
27 | std::unique_ptr<QPlatformDialogHelper> QQuickDialogImplFactory::createPlatformDialogHelper(QQuickDialogType type, QObject *parent) |
28 | { |
29 | std::unique_ptr<QPlatformDialogHelper> dialogHelper; |
30 | switch (type) { |
31 | case QQuickDialogType::ColorDialog: { |
32 | dialogHelper.reset(p: new QQuickPlatformColorDialog(parent)); |
33 | break; |
34 | } |
35 | #if QT_CONFIG(quick_listview) |
36 | case QQuickDialogType::FileDialog: { |
37 | dialogHelper.reset(p: new QQuickPlatformFileDialog(parent)); |
38 | break; |
39 | } |
40 | case QQuickDialogType::FolderDialog: { |
41 | dialogHelper.reset(p: new QQuickPlatformFolderDialog(parent)); |
42 | break; |
43 | } |
44 | case QQuickDialogType::FontDialog: { |
45 | dialogHelper.reset(p: new QQuickPlatformFontDialog(parent)); |
46 | break; |
47 | } |
48 | #endif |
49 | case QQuickDialogType::MessageDialog: { |
50 | dialogHelper.reset(p: new QQuickPlatformMessageDialog(parent)); |
51 | break; |
52 | } |
53 | default: |
54 | break; |
55 | } |
56 | |
57 | return dialogHelper; |
58 | } |
59 | |
60 | QT_END_NAMESPACE |
61 |