Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquicktreeview_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKTREEVIEW_P_H
6#define QQUICKTREEVIEW_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qabstractitemmodel.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQuickTreeViewPrivate;
25
26class Q_QUICK_EXPORT QQuickTreeView : public QQuickTableView
27{
28 Q_OBJECT
29 Q_PROPERTY(QModelIndex rootIndex READ rootIndex WRITE setRootIndex RESET resetRootIndex NOTIFY rootIndexChanged REVISION(6, 6) FINAL)
30 QML_NAMED_ELEMENT(TreeView)
31 QML_ADDED_IN_VERSION(6, 3)
32
33public:
34 QQuickTreeView(QQuickItem *parent = nullptr);
35 ~QQuickTreeView() override;
36
37 QModelIndex rootIndex() const;
38 void setRootIndex(const QModelIndex &index);
39 void resetRootIndex();
40
41 Q_INVOKABLE int depth(int row) const;
42
43 Q_INVOKABLE bool isExpanded(int row) const;
44 Q_INVOKABLE void expand(int row);
45 Q_INVOKABLE void collapse(int row);
46 Q_INVOKABLE void toggleExpanded(int row);
47
48 Q_REVISION(6, 4) Q_INVOKABLE void expandRecursively(int row = -1, int depth = -1);
49 Q_REVISION(6, 4) Q_INVOKABLE void collapseRecursively(int row = -1);
50 Q_REVISION(6, 4) Q_INVOKABLE void expandToIndex(const QModelIndex &index);
51
52 Q_INVOKABLE QModelIndex modelIndex(const QPoint &cell) const override;
53 Q_INVOKABLE QPoint cellAtIndex(const QModelIndex &index) const override;
54
55#if QT_DEPRECATED_SINCE(6, 4)
56 QT_DEPRECATED_VERSION_X_6_4("Use index(row, column) instead")
57 Q_REVISION(6, 4) Q_INVOKABLE QModelIndex modelIndex(int row, int column) const override;
58#endif
59
60Q_SIGNALS:
61 void expanded(int row, int depth);
62 void collapsed(int row, bool recursively);
63 Q_REVISION(6, 6) void rootIndexChanged();
64
65protected:
66 void keyPressEvent(QKeyEvent *event) override;
67
68private:
69 Q_DISABLE_COPY(QQuickTreeView)
70 Q_DECLARE_PRIVATE(QQuickTreeView)
71};
72
73QT_END_NAMESPACE
74
75#endif // QQUICKTREEVIEW_P_H
static const int kTreeColumn
\qmlproperty QModelIndex QtQuick::TreeView::rootIndex