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
qquicktreeviewdelegate_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 QQUICKTREEVIEWDELEGATE_P_H
6#define QQUICKTREEVIEWDELEGATE_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 <QtQuick/qquickitem.h>
20#include <QtQuick/private/qquicktreeview_p.h>
21#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
22#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QQuickTreeViewDelegatePrivate;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickTreeViewDelegate : public QQuickItemDelegate
29{
30 Q_OBJECT
31 Q_PROPERTY(qreal indentation READ indentation WRITE setIndentation NOTIFY indentationChanged FINAL)
32 Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged FINAL)
33 Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged FINAL)
34
35 // Required properties
36 Q_PROPERTY(QQuickTreeView *treeView READ treeView WRITE setTreeView NOTIFY treeviewChanged REQUIRED FINAL)
37 Q_PROPERTY(bool isTreeNode READ isTreeNode WRITE setIsTreeNode NOTIFY isTreeNodeChanged REQUIRED FINAL)
38 Q_PROPERTY(bool hasChildren READ hasChildren WRITE setHasChildren NOTIFY hasChildrenChanged REQUIRED FINAL)
39 Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged REQUIRED FINAL)
40 Q_PROPERTY(int depth READ depth WRITE setDepth NOTIFY depthChanged REQUIRED FINAL)
41 Q_PROPERTY(bool current READ current WRITE setCurrent NOTIFY currentChanged REQUIRED FINAL REVISION(6, 4))
42 Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged REQUIRED FINAL REVISION(6, 4))
43 Q_PROPERTY(bool editing READ editing WRITE setEditing NOTIFY editingChanged REQUIRED FINAL REVISION(6, 5))
44
45 QML_NAMED_ELEMENT(TreeViewDelegate)
46 QML_ADDED_IN_VERSION(6, 3)
47
48public:
49 explicit QQuickTreeViewDelegate(QQuickItem *parent = nullptr);
50
51 qreal indentation() const;
52 void setIndentation(qreal indentation);
53
54 bool isTreeNode() const;
55 void setIsTreeNode(bool isTreeNode);
56
57 bool hasChildren() const;
58 void setHasChildren(bool hasChildren);
59
60 bool expanded() const;
61 void setExpanded(bool expanded);
62
63 bool current() const;
64 void setCurrent(bool current);
65
66 bool selected() const;
67 void setSelected(bool selected);
68
69 bool editing() const;
70 void setEditing(bool editing);
71
72 int depth() const;
73 void setDepth(int depth);
74
75 QQuickTreeView *treeView() const;
76 void setTreeView(QQuickTreeView *treeView);
77
78 qreal leftMargin() const;
79 void setLeftMargin(qreal leftMargin);
80
81 qreal rightMargin() const;
82 void setRightMargin(qreal rightMargin);
83
84Q_SIGNALS:
85 void indicatorChanged();
86 void indentationChanged();
87 void isTreeNodeChanged();
88 void hasChildrenChanged();
89 void expandedChanged();
90 void depthChanged();
91 void treeviewChanged();
92 void leftMarginChanged();
93 void rightMarginChanged();
94 Q_REVISION(6, 4) void currentChanged();
95 Q_REVISION(6, 4) void selectedChanged();
96 Q_REVISION(6, 5) void editingChanged();
97
98protected:
99 QFont defaultFont() const override;
100 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
101 void componentComplete() override;
102 void mousePressEvent(QMouseEvent *event) override;
103
104private:
105 Q_DISABLE_COPY(QQuickTreeViewDelegate)
106 Q_DECLARE_PRIVATE(QQuickTreeViewDelegate)
107};
108
109QT_END_NAMESPACE
110
111#endif // QQUICKTREEVIEWDELEGATE_P_H
QPointer< QQuickTreeView > m_treeView
QPointer< QQuickTapHandler > m_tapHandlerOnIndicator
QPalette defaultPalette() const override