source: trunk/tools/shared/qtpropertybrowser/qttreepropertybrowser.h@ 158

Last change on this file since 158 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 4.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QTTREEPROPERTYBROWSER_H
43#define QTTREEPROPERTYBROWSER_H
44
45#include "qtpropertybrowser.h"
46
47#if QT_VERSION >= 0x040400
48QT_BEGIN_NAMESPACE
49#endif
50
51class QTreeWidgetItem;
52class QtTreePropertyBrowserPrivate;
53
54class QtTreePropertyBrowser : public QtAbstractPropertyBrowser
55{
56 Q_OBJECT
57 Q_ENUMS(ResizeMode)
58 Q_PROPERTY(int indentation READ indentation WRITE setIndentation)
59 Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated)
60 Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors)
61 Q_PROPERTY(bool headerVisible READ isHeaderVisible WRITE setHeaderVisible)
62 Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
63 Q_PROPERTY(int splitterPosition READ splitterPosition WRITE setSplitterPosition)
64 Q_PROPERTY(bool propertiesWithoutValueMarked READ propertiesWithoutValueMarked WRITE setPropertiesWithoutValueMarked)
65public:
66
67 enum ResizeMode
68 {
69 Interactive,
70 Stretch,
71 Fixed,
72 ResizeToContents
73 };
74
75 QtTreePropertyBrowser(QWidget *parent = 0);
76 ~QtTreePropertyBrowser();
77
78 int indentation() const;
79 void setIndentation(int i);
80
81 bool rootIsDecorated() const;
82 void setRootIsDecorated(bool show);
83
84 bool alternatingRowColors() const;
85 void setAlternatingRowColors(bool enable);
86
87 bool isHeaderVisible() const;
88 void setHeaderVisible(bool visible);
89
90 ResizeMode resizeMode() const;
91 void setResizeMode(ResizeMode mode);
92
93 int splitterPosition() const;
94 void setSplitterPosition(int position);
95
96 void setExpanded(QtBrowserItem *item, bool expanded);
97 bool isExpanded(QtBrowserItem *item) const;
98
99 bool isItemVisible(QtBrowserItem *item) const;
100 void setItemVisible(QtBrowserItem *item, bool visible);
101
102 void setBackgroundColor(QtBrowserItem *item, const QColor &color);
103 QColor backgroundColor(QtBrowserItem *item) const;
104 QColor calculatedBackgroundColor(QtBrowserItem *item) const;
105
106 void setPropertiesWithoutValueMarked(bool mark);
107 bool propertiesWithoutValueMarked() const;
108
109 void editItem(QtBrowserItem *item);
110
111Q_SIGNALS:
112
113 void collapsed(QtBrowserItem *item);
114 void expanded(QtBrowserItem *item);
115
116protected:
117 virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem);
118 virtual void itemRemoved(QtBrowserItem *item);
119 virtual void itemChanged(QtBrowserItem *item);
120
121private:
122
123 QtTreePropertyBrowserPrivate *d_ptr;
124 Q_DECLARE_PRIVATE(QtTreePropertyBrowser)
125 Q_DISABLE_COPY(QtTreePropertyBrowser)
126
127 Q_PRIVATE_SLOT(d_func(), void slotCollapsed(const QModelIndex &))
128 Q_PRIVATE_SLOT(d_func(), void slotExpanded(const QModelIndex &))
129 Q_PRIVATE_SLOT(d_func(), void slotCurrentBrowserItemChanged(QtBrowserItem *))
130 Q_PRIVATE_SLOT(d_func(), void slotCurrentTreeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))
131
132};
133
134#if QT_VERSION >= 0x040400
135QT_END_NAMESPACE
136#endif
137
138#endif
Note: See TracBrowser for help on using the repository browser.