author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QTREEVIEW_H |
|
43 |
#define QTREEVIEW_H |
|
44 |
||
45 |
#include <QtGui/qabstractitemview.h> |
|
46 |
||
47 |
QT_BEGIN_HEADER |
|
48 |
||
49 |
QT_BEGIN_NAMESPACE |
|
50 |
||
51 |
QT_MODULE(Gui) |
|
52 |
||
53 |
#ifndef QT_NO_TREEVIEW |
|
54 |
||
55 |
class QTreeViewPrivate; |
|
56 |
class QHeaderView; |
|
57 |
||
58 |
class Q_GUI_EXPORT QTreeView : public QAbstractItemView |
|
59 |
{ |
|
60 |
Q_OBJECT |
|
61 |
Q_PROPERTY(int autoExpandDelay READ autoExpandDelay WRITE setAutoExpandDelay) |
|
62 |
Q_PROPERTY(int indentation READ indentation WRITE setIndentation) |
|
63 |
Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated) |
|
64 |
Q_PROPERTY(bool uniformRowHeights READ uniformRowHeights WRITE setUniformRowHeights) |
|
65 |
Q_PROPERTY(bool itemsExpandable READ itemsExpandable WRITE setItemsExpandable) |
|
66 |
Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled) |
|
67 |
Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated) |
|
68 |
Q_PROPERTY(bool allColumnsShowFocus READ allColumnsShowFocus WRITE setAllColumnsShowFocus) |
|
69 |
Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) |
|
70 |
Q_PROPERTY(bool headerHidden READ isHeaderHidden WRITE setHeaderHidden) |
|
71 |
Q_PROPERTY(bool expandsOnDoubleClick READ expandsOnDoubleClick WRITE setExpandsOnDoubleClick) |
|
72 |
||
73 |
public: |
|
74 |
explicit QTreeView(QWidget *parent = 0); |
|
75 |
~QTreeView(); |
|
76 |
||
77 |
void setModel(QAbstractItemModel *model); |
|
78 |
void setRootIndex(const QModelIndex &index); |
|
79 |
void setSelectionModel(QItemSelectionModel *selectionModel); |
|
80 |
||
81 |
QHeaderView *header() const; |
|
82 |
void setHeader(QHeaderView *header); |
|
83 |
||
84 |
int autoExpandDelay() const; |
|
85 |
void setAutoExpandDelay(int delay); |
|
86 |
||
87 |
int indentation() const; |
|
88 |
void setIndentation(int i); |
|
89 |
||
90 |
bool rootIsDecorated() const; |
|
91 |
void setRootIsDecorated(bool show); |
|
92 |
||
93 |
bool uniformRowHeights() const; |
|
94 |
void setUniformRowHeights(bool uniform); |
|
95 |
||
96 |
bool itemsExpandable() const; |
|
97 |
void setItemsExpandable(bool enable); |
|
98 |
||
99 |
bool expandsOnDoubleClick() const; |
|
100 |
void setExpandsOnDoubleClick(bool enable); |
|
101 |
||
102 |
int columnViewportPosition(int column) const; |
|
103 |
int columnWidth(int column) const; |
|
104 |
void setColumnWidth(int column, int width); |
|
105 |
int columnAt(int x) const; |
|
106 |
||
107 |
bool isColumnHidden(int column) const; |
|
108 |
void setColumnHidden(int column, bool hide); |
|
109 |
||
110 |
bool isHeaderHidden() const; |
|
111 |
void setHeaderHidden(bool hide); |
|
112 |
||
113 |
bool isRowHidden(int row, const QModelIndex &parent) const; |
|
114 |
void setRowHidden(int row, const QModelIndex &parent, bool hide); |
|
115 |
||
116 |
bool isFirstColumnSpanned(int row, const QModelIndex &parent) const; |
|
117 |
void setFirstColumnSpanned(int row, const QModelIndex &parent, bool span); |
|
118 |
||
119 |
bool isExpanded(const QModelIndex &index) const; |
|
120 |
void setExpanded(const QModelIndex &index, bool expand); |
|
121 |
||
122 |
void setSortingEnabled(bool enable); |
|
123 |
bool isSortingEnabled() const; |
|
124 |
||
125 |
void setAnimated(bool enable); |
|
126 |
bool isAnimated() const; |
|
127 |
||
128 |
void setAllColumnsShowFocus(bool enable); |
|
129 |
bool allColumnsShowFocus() const; |
|
130 |
||
131 |
void setWordWrap(bool on); |
|
132 |
bool wordWrap() const; |
|
133 |
||
134 |
void keyboardSearch(const QString &search); |
|
135 |
||
136 |
QRect visualRect(const QModelIndex &index) const; |
|
137 |
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); |
|
138 |
QModelIndex indexAt(const QPoint &p) const; |
|
139 |
QModelIndex indexAbove(const QModelIndex &index) const; |
|
140 |
QModelIndex indexBelow(const QModelIndex &index) const; |
|
141 |
||
142 |
void doItemsLayout(); |
|
143 |
void reset(); |
|
144 |
||
145 |
void sortByColumn(int column, Qt::SortOrder order); |
|
146 |
||
147 |
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); |
|
148 |
void selectAll(); |
|
149 |
||
150 |
Q_SIGNALS: |
|
151 |
void expanded(const QModelIndex &index); |
|
152 |
void collapsed(const QModelIndex &index); |
|
153 |
||
154 |
public Q_SLOTS: |
|
155 |
void hideColumn(int column); |
|
156 |
void showColumn(int column); |
|
157 |
void expand(const QModelIndex &index); |
|
158 |
void collapse(const QModelIndex &index); |
|
159 |
void resizeColumnToContents(int column); |
|
160 |
void sortByColumn(int column); |
|
161 |
void expandAll(); |
|
162 |
void collapseAll(); |
|
163 |
void expandToDepth(int depth); |
|
164 |
||
165 |
protected Q_SLOTS: |
|
166 |
void columnResized(int column, int oldSize, int newSize); |
|
167 |
void columnCountChanged(int oldCount, int newCount); |
|
168 |
void columnMoved(); |
|
169 |
void reexpand(); |
|
170 |
void rowsRemoved(const QModelIndex &parent, int first, int last); |
|
171 |
||
172 |
protected: |
|
173 |
QTreeView(QTreeViewPrivate &dd, QWidget *parent = 0); |
|
174 |
void scrollContentsBy(int dx, int dy); |
|
175 |
void rowsInserted(const QModelIndex &parent, int start, int end); |
|
176 |
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); |
|
177 |
||
178 |
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); |
|
179 |
int horizontalOffset() const; |
|
180 |
int verticalOffset() const; |
|
181 |
||
182 |
void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); |
|
183 |
QRegion visualRegionForSelection(const QItemSelection &selection) const; |
|
184 |
QModelIndexList selectedIndexes() const; |
|
185 |
||
186 |
void timerEvent(QTimerEvent *event); |
|
187 |
void paintEvent(QPaintEvent *event); |
|
188 |
||
189 |
void drawTree(QPainter *painter, const QRegion ®ion) const; |
|
190 |
virtual void drawRow(QPainter *painter, |
|
191 |
const QStyleOptionViewItem &options, |
|
192 |
const QModelIndex &index) const; |
|
193 |
virtual void drawBranches(QPainter *painter, |
|
194 |
const QRect &rect, |
|
195 |
const QModelIndex &index) const; |
|
196 |
||
197 |
void mousePressEvent(QMouseEvent *event); |
|
198 |
void mouseReleaseEvent(QMouseEvent *event); |
|
199 |
void mouseDoubleClickEvent(QMouseEvent *event); |
|
200 |
void mouseMoveEvent(QMouseEvent *event); |
|
201 |
void keyPressEvent(QKeyEvent *event); |
|
202 |
#ifndef QT_NO_DRAGANDDROP |
|
203 |
void dragMoveEvent(QDragMoveEvent *event); |
|
204 |
#endif |
|
205 |
bool viewportEvent(QEvent *event); |
|
206 |
||
207 |
void updateGeometries(); |
|
208 |
||
209 |
int sizeHintForColumn(int column) const; |
|
210 |
int indexRowSizeHint(const QModelIndex &index) const; |
|
211 |
int rowHeight(const QModelIndex &index) const; |
|
212 |
||
213 |
void horizontalScrollbarAction(int action); |
|
214 |
||
215 |
bool isIndexHidden(const QModelIndex &index) const; |
|
216 |
void selectionChanged(const QItemSelection &selected, |
|
217 |
const QItemSelection &deselected); |
|
218 |
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); |
|
219 |
||
220 |
private: |
|
221 |
friend class QAccessibleItemView; |
|
222 |
int visualIndex(const QModelIndex &index) const; |
|
223 |
||
224 |
Q_DECLARE_PRIVATE(QTreeView) |
|
225 |
Q_DISABLE_COPY(QTreeView) |
|
226 |
#ifndef QT_NO_ANIMATION |
|
227 |
Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation()) |
|
228 |
#endif //QT_NO_ANIMATION |
|
229 |
Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset()) |
|
230 |
Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order)) |
|
231 |
}; |
|
232 |
||
233 |
#endif // QT_NO_TREEVIEW |
|
234 |
||
235 |
QT_END_NAMESPACE |
|
236 |
||
237 |
QT_END_HEADER |
|
238 |
||
239 |
#endif // QTREEVIEW_H |