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#ifndef QQUICKFOLDERDIALOGIMPL_P_H
5#define QQUICKFOLDERDIALOGIMPL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This folder is not part of the Qt API. It exists purely as an
12// implementation detail. This header folder may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qquicklistview_p.h>
19#include <QtQuickTemplates2/private/qquickdialog_p.h>
20
21#include "qtquickdialogs2quickimplglobal_p.h"
22
23QT_BEGIN_NAMESPACE
24
25class QQuickDialogButtonBox;
26
27class QQuickFolderDialogImplAttached;
28class QQuickFolderDialogImplAttachedPrivate;
29class QQuickFolderDialogImplPrivate;
30class QQuickFolderBreadcrumbBar;
31
32class Q_QUICKDIALOGS2QUICKIMPL_PRIVATE_EXPORT QQuickFolderDialogImpl : public QQuickDialog
33{
34 Q_OBJECT
35 Q_PROPERTY(QUrl currentFolder READ currentFolder WRITE setCurrentFolder NOTIFY currentFolderChanged FINAL)
36 Q_PROPERTY(QUrl selectedFolder READ selectedFolder WRITE setSelectedFolder NOTIFY selectedFolderChanged FINAL)
37 QML_NAMED_ELEMENT(FolderDialogImpl)
38 QML_ATTACHED(QQuickFolderDialogImplAttached)
39 QML_ADDED_IN_VERSION(6, 3)
40
41public:
42 explicit QQuickFolderDialogImpl(QObject *parent = nullptr);
43
44 static QQuickFolderDialogImplAttached *qmlAttachedProperties(QObject *object);
45
46 QUrl currentFolder() const;
47 void setCurrentFolder(const QUrl &folder);
48
49 QUrl selectedFolder() const;
50 void setSelectedFolder(const QUrl &selectedFolder);
51
52 QSharedPointer<QFileDialogOptions> options() const;
53 void setOptions(const QSharedPointer<QFileDialogOptions> &options);
54
55 void setAcceptLabel(const QString &label);
56 void setRejectLabel(const QString &label);
57
58Q_SIGNALS:
59 void currentFolderChanged(const QUrl &folderUrl);
60 void selectedFolderChanged(const QUrl &folderUrl);
61 void nameFiltersChanged();
62
63private:
64 void componentComplete() override;
65 void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override;
66
67 Q_DISABLE_COPY(QQuickFolderDialogImpl)
68 Q_DECLARE_PRIVATE(QQuickFolderDialogImpl)
69};
70
71class Q_QUICKDIALOGS2QUICKIMPL_PRIVATE_EXPORT QQuickFolderDialogImplAttached : public QObject
72{
73 Q_OBJECT
74 Q_PROPERTY(QQuickListView *folderDialogListView READ folderDialogListView WRITE setFolderDialogListView NOTIFY folderDialogListViewChanged)
75 Q_PROPERTY(QQuickFolderBreadcrumbBar *breadcrumbBar READ breadcrumbBar WRITE setBreadcrumbBar NOTIFY breadcrumbBarChanged)
76 Q_MOC_INCLUDE(<QtQuickTemplates2/private/qquickdialogbuttonbox_p.h>)
77
78public:
79 explicit QQuickFolderDialogImplAttached(QObject *parent = nullptr);
80
81 QQuickListView *folderDialogListView() const;
82 void setFolderDialogListView(QQuickListView *folderDialogListView);
83
84 QQuickFolderBreadcrumbBar *breadcrumbBar() const;
85 void setBreadcrumbBar(QQuickFolderBreadcrumbBar *breadcrumbBar);
86
87Q_SIGNALS:
88 void folderDialogListViewChanged();
89 void breadcrumbBarChanged();
90
91private:
92 Q_DISABLE_COPY(QQuickFolderDialogImplAttached)
93 Q_DECLARE_PRIVATE(QQuickFolderDialogImplAttached)
94};
95
96QT_END_NAMESPACE
97
98QML_DECLARE_TYPE(QQuickFolderDialogImpl)
99
100#endif // QQUICKFOLDERDIALOGIMPL_P_H
101

source code of qtdeclarative/src/quickdialogs/quickdialogsquickimpl/qquickfolderdialogimpl_p.h