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 QQUICKFOLDERBREADCRUMBBAR_P_P_H
5#define QQUICKFOLDERBREADCRUMBBAR_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTemplates2/private/qquickcontainer_p_p.h>
19#include <QtQuickTemplates2/private/qquickdeferredexecute_p_p.h>
20#include <QtQuickTemplates2/private/qquickdialog_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQuickAbstractButton;
25class QQuickTextField;
26
27class QQuickFileDialogImpl;
28class QQuickFolderDialogImpl;
29
30class Q_QUICKDIALOGS2QUICKIMPL_PRIVATE_EXPORT QQuickFolderBreadcrumbBarPrivate : public QQuickContainerPrivate
31{
32public:
33 Q_DECLARE_PUBLIC(QQuickFolderBreadcrumbBar)
34
35 QQuickItem *createDelegateItem(QQmlComponent *component, const QVariantMap &initialProperties);
36 static QString folderBaseName(const QString &folderPath);
37 static QStringList crumbPathsForFolder(const QUrl &folder);
38 void repopulate();
39 void crumbClicked();
40 void folderChanged();
41
42 void cancelUpButton();
43 void executeUpButton(bool complete = false);
44 void goUp();
45
46 void cancelTextField();
47 void executeTextField(bool complete = false);
48 void toggleTextFieldVisibility();
49 void textFieldAccepted();
50
51 void textFieldVisibleChanged();
52 void textFieldActiveFocusChanged();
53 void handleTextFieldShown();
54 void handleTextFieldHidden();
55 void ungrabEditPathShortcut();
56
57 QQuickFileDialogImpl *asFileDialog() const;
58 QQuickFolderDialogImpl *asFolderDialog() const;
59 bool isFileDialog() const;
60 QUrl dialogFolder() const;
61 void setDialogFolder(const QUrl &folder);
62
63 qreal getContentWidth() const override;
64 qreal getContentHeight() const override;
65 void resizeContent() override;
66
67 void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
68 void itemImplicitWidthChanged(QQuickItem *item) override;
69 void itemImplicitHeightChanged(QQuickItem *item) override;
70
71private:
72 QQuickDialog *dialog = nullptr;
73 QList<QString> folderPaths;
74 QQmlComponent *buttonDelegate = nullptr;
75 QQmlComponent *separatorDelegate = nullptr;
76 QQuickDeferredPointer<QQuickAbstractButton> upButton;
77 QQuickDeferredPointer<QQuickTextField> textField;
78 int editPathToggleShortcutId = 0;
79#if QT_CONFIG(shortcut)
80 int goUpShortcutId = 0;
81#endif
82 int upButtonSpacing = 0;
83 bool repopulating = false;
84};
85
86QT_END_NAMESPACE
87
88#endif // QQUICKFOLDERBREADCRUMBBAR_P_P_H
89

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