1 | // Copyright (C) 2016 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 QTTREEPROPERTYBROWSER_H |
5 | #define QTTREEPROPERTYBROWSER_H |
6 | |
7 | #include "qtpropertybrowser.h" |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QTreeWidgetItem; |
12 | class QtTreePropertyBrowserPrivate; |
13 | |
14 | class QtTreePropertyBrowser : public QtAbstractPropertyBrowser |
15 | { |
16 | Q_OBJECT |
17 | Q_PROPERTY(int indentation READ indentation WRITE setIndentation) |
18 | Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated) |
19 | Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors) |
20 | Q_PROPERTY(bool headerVisible READ isHeaderVisible WRITE setHeaderVisible) |
21 | Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) |
22 | Q_PROPERTY(int splitterPosition READ splitterPosition WRITE setSplitterPosition) |
23 | Q_PROPERTY(bool propertiesWithoutValueMarked READ propertiesWithoutValueMarked WRITE setPropertiesWithoutValueMarked) |
24 | public: |
25 | enum ResizeMode |
26 | { |
27 | Interactive, |
28 | Stretch, |
29 | Fixed, |
30 | ResizeToContents |
31 | }; |
32 | Q_ENUM(ResizeMode) |
33 | |
34 | QtTreePropertyBrowser(QWidget *parent = 0); |
35 | ~QtTreePropertyBrowser(); |
36 | |
37 | int indentation() const; |
38 | void setIndentation(int i); |
39 | |
40 | bool rootIsDecorated() const; |
41 | void setRootIsDecorated(bool show); |
42 | |
43 | bool alternatingRowColors() const; |
44 | void setAlternatingRowColors(bool enable); |
45 | |
46 | bool isHeaderVisible() const; |
47 | void setHeaderVisible(bool visible); |
48 | |
49 | ResizeMode resizeMode() const; |
50 | void setResizeMode(ResizeMode mode); |
51 | |
52 | int splitterPosition() const; |
53 | void setSplitterPosition(int position); |
54 | |
55 | void setExpanded(QtBrowserItem *item, bool expanded); |
56 | bool isExpanded(QtBrowserItem *item) const; |
57 | |
58 | bool isItemVisible(QtBrowserItem *item) const; |
59 | void setItemVisible(QtBrowserItem *item, bool visible); |
60 | |
61 | void setBackgroundColor(QtBrowserItem *item, const QColor &color); |
62 | QColor backgroundColor(QtBrowserItem *item) const; |
63 | QColor calculatedBackgroundColor(QtBrowserItem *item) const; |
64 | |
65 | void setPropertiesWithoutValueMarked(bool mark); |
66 | bool propertiesWithoutValueMarked() const; |
67 | |
68 | void editItem(QtBrowserItem *item); |
69 | |
70 | Q_SIGNALS: |
71 | void collapsed(QtBrowserItem *item); |
72 | void expanded(QtBrowserItem *item); |
73 | |
74 | protected: |
75 | void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem) override; |
76 | void itemRemoved(QtBrowserItem *item) override; |
77 | void itemChanged(QtBrowserItem *item) override; |
78 | |
79 | private: |
80 | QScopedPointer<QtTreePropertyBrowserPrivate> d_ptr; |
81 | Q_DECLARE_PRIVATE(QtTreePropertyBrowser) |
82 | Q_DISABLE_COPY_MOVE(QtTreePropertyBrowser) |
83 | }; |
84 | |
85 | QT_END_NAMESPACE |
86 | |
87 | #endif |
88 |