Qt 4.8
qtreewidget.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QTREEWIDGET_H
43 #define QTREEWIDGET_H
44 
45 #include <QtGui/qtreeview.h>
46 #include <QtGui/qtreewidgetitemiterator.h>
47 #include <QtCore/qvariant.h>
48 #include <QtCore/qvector.h>
49 
51 
53 
54 QT_MODULE(Gui)
55 
56 #ifndef QT_NO_TREEWIDGET
57 
58 class QTreeWidget;
59 class QTreeModel;
60 class QWidgetItemData;
62 
64 {
65  friend class QTreeModel;
66  friend class QTreeWidget;
67  friend class QTreeWidgetPrivate;
69  friend class QTreeWidgetItemPrivate;
70 public:
71  enum ItemType { Type = 0, UserType = 1000 };
72  explicit QTreeWidgetItem(int type = Type);
73  QTreeWidgetItem(const QStringList &strings, int type = Type);
74  explicit QTreeWidgetItem(QTreeWidget *view, int type = Type);
75  QTreeWidgetItem(QTreeWidget *view, const QStringList &strings, int type = Type);
76  QTreeWidgetItem(QTreeWidget *view, QTreeWidgetItem *after, int type = Type);
77  explicit QTreeWidgetItem(QTreeWidgetItem *parent, int type = Type);
78  QTreeWidgetItem(QTreeWidgetItem *parent, const QStringList &strings, int type = Type);
80  QTreeWidgetItem(const QTreeWidgetItem &other);
81  virtual ~QTreeWidgetItem();
82 
83  virtual QTreeWidgetItem *clone() const;
84 
85  inline QTreeWidget *treeWidget() const { return view; }
86 
87  inline void setSelected(bool select);
88  inline bool isSelected() const;
89 
90  inline void setHidden(bool hide);
91  inline bool isHidden() const;
92 
93  inline void setExpanded(bool expand);
94  inline bool isExpanded() const;
95 
96  inline void setFirstColumnSpanned(bool span);
97  inline bool isFirstColumnSpanned() const;
98 
99  inline void setDisabled(bool disabled);
100  inline bool isDisabled() const;
101 
102  enum ChildIndicatorPolicy { ShowIndicator, DontShowIndicator, DontShowIndicatorWhenChildless };
103  void setChildIndicatorPolicy(QTreeWidgetItem::ChildIndicatorPolicy policy);
104  QTreeWidgetItem::ChildIndicatorPolicy childIndicatorPolicy() const;
105 
106  Qt::ItemFlags flags() const;
107  void setFlags(Qt::ItemFlags flags);
108 
109  inline QString text(int column) const
110  { return data(column, Qt::DisplayRole).toString(); }
111  inline void setText(int column, const QString &text);
112 
113  inline QIcon icon(int column) const
114  { return qvariant_cast<QIcon>(data(column, Qt::DecorationRole)); }
115  inline void setIcon(int column, const QIcon &icon);
116 
117  inline QString statusTip(int column) const
118  { return data(column, Qt::StatusTipRole).toString(); }
119  inline void setStatusTip(int column, const QString &statusTip);
120 
121 #ifndef QT_NO_TOOLTIP
122  inline QString toolTip(int column) const
123  { return data(column, Qt::ToolTipRole).toString(); }
124  inline void setToolTip(int column, const QString &toolTip);
125 #endif
126 
127 #ifndef QT_NO_WHATSTHIS
128  inline QString whatsThis(int column) const
129  { return data(column, Qt::WhatsThisRole).toString(); }
130  inline void setWhatsThis(int column, const QString &whatsThis);
131 #endif
132 
133  inline QFont font(int column) const
134  { return qvariant_cast<QFont>(data(column, Qt::FontRole)); }
135  inline void setFont(int column, const QFont &font);
136 
137  inline int textAlignment(int column) const
138  { return data(column, Qt::TextAlignmentRole).toInt(); }
139  inline void setTextAlignment(int column, int alignment)
140  { setData(column, Qt::TextAlignmentRole, alignment); }
141 
142  inline QColor backgroundColor(int column) const
143  { return qvariant_cast<QColor>(data(column, Qt::BackgroundColorRole)); }
144  inline void setBackgroundColor(int column, const QColor &color)
145  { setData(column, Qt::BackgroundColorRole, color); }
146 
147  inline QBrush background(int column) const
148  { return qvariant_cast<QBrush>(data(column, Qt::BackgroundRole)); }
149  inline void setBackground(int column, const QBrush &brush)
150  { setData(column, Qt::BackgroundRole, brush); }
151 
152  inline QColor textColor(int column) const
153  { return qvariant_cast<QColor>(data(column, Qt::TextColorRole)); }
154  inline void setTextColor(int column, const QColor &color)
155  { setData(column, Qt::TextColorRole, color); }
156 
157  inline QBrush foreground(int column) const
158  { return qvariant_cast<QBrush>(data(column, Qt::ForegroundRole)); }
159  inline void setForeground(int column, const QBrush &brush)
160  { setData(column, Qt::ForegroundRole, brush); }
161 
162  inline Qt::CheckState checkState(int column) const
163  { return static_cast<Qt::CheckState>(data(column, Qt::CheckStateRole).toInt()); }
164  inline void setCheckState(int column, Qt::CheckState state)
165  { setData(column, Qt::CheckStateRole, state); }
166 
167  inline QSize sizeHint(int column) const
168  { return qvariant_cast<QSize>(data(column, Qt::SizeHintRole)); }
169  inline void setSizeHint(int column, const QSize &size)
170  { setData(column, Qt::SizeHintRole, size); }
171 
172  virtual QVariant data(int column, int role) const;
173  virtual void setData(int column, int role, const QVariant &value);
174 
175  virtual bool operator<(const QTreeWidgetItem &other) const;
176 
177 #ifndef QT_NO_DATASTREAM
178  virtual void read(QDataStream &in);
179  virtual void write(QDataStream &out) const;
180 #endif
181  QTreeWidgetItem &operator=(const QTreeWidgetItem &other);
182 
183  inline QTreeWidgetItem *parent() const { return par; }
184  inline QTreeWidgetItem *child(int index) const {
185  if (index < 0 || index >= children.size())
186  return 0;
187  executePendingSort();
188  return children.at(index);
189  }
190  inline int childCount() const { return children.count(); }
191  inline int columnCount() const { return values.count(); }
192  inline int indexOfChild(QTreeWidgetItem *child) const;
193 
194  void addChild(QTreeWidgetItem *child);
195  void insertChild(int index, QTreeWidgetItem *child);
196  void removeChild(QTreeWidgetItem *child);
197  QTreeWidgetItem *takeChild(int index);
198 
199  void addChildren(const QList<QTreeWidgetItem*> &children);
200  void insertChildren(int index, const QList<QTreeWidgetItem*> &children);
201  QList<QTreeWidgetItem*> takeChildren();
202 
203  inline int type() const { return rtti; }
204  inline void sortChildren(int column, Qt::SortOrder order)
205  { sortChildren(column, order, false); }
206 
207 protected:
208  void emitDataChanged();
209 
210 private:
211  void sortChildren(int column, Qt::SortOrder order, bool climb);
212  QVariant childrenCheckState(int column) const;
213  void itemChanged();
214  void executePendingSort() const;
215 
216  int rtti;
217  // One item has a vector of column entries. Each column has a vector of (role, value) pairs.
223  Qt::ItemFlags itemFlags;
224 };
225 
226 inline void QTreeWidgetItem::setText(int column, const QString &atext)
227 { setData(column, Qt::DisplayRole, atext); }
228 
229 inline void QTreeWidgetItem::setIcon(int column, const QIcon &aicon)
230 { setData(column, Qt::DecorationRole, aicon); }
231 
232 #ifndef QT_NO_STATUSTIP
233 inline void QTreeWidgetItem::setStatusTip(int column, const QString &astatusTip)
234 { setData(column, Qt::StatusTipRole, astatusTip); }
235 #endif
236 
237 #ifndef QT_NO_TOOLTIP
238 inline void QTreeWidgetItem::setToolTip(int column, const QString &atoolTip)
239 { setData(column, Qt::ToolTipRole, atoolTip); }
240 #endif
241 
242 #ifndef QT_NO_WHATSTHIS
243 inline void QTreeWidgetItem::setWhatsThis(int column, const QString &awhatsThis)
244 { setData(column, Qt::WhatsThisRole, awhatsThis); }
245 #endif
246 
247 inline void QTreeWidgetItem::setFont(int column, const QFont &afont)
248 { setData(column, Qt::FontRole, afont); }
249 
251 { executePendingSort(); return children.indexOf(achild); }
252 
253 #ifndef QT_NO_DATASTREAM
256 #endif
257 
258 class QTreeWidgetPrivate;
259 
261 {
262  Q_OBJECT
265 
266  friend class QTreeModel;
267  friend class QTreeWidgetItem;
268 public:
269  explicit QTreeWidget(QWidget *parent = 0);
270  ~QTreeWidget();
271 
272  int columnCount() const;
273  void setColumnCount(int columns);
274 
275  QTreeWidgetItem *invisibleRootItem() const;
276  QTreeWidgetItem *topLevelItem(int index) const;
277  int topLevelItemCount() const;
278  void insertTopLevelItem(int index, QTreeWidgetItem *item);
279  void addTopLevelItem(QTreeWidgetItem *item);
280  QTreeWidgetItem *takeTopLevelItem(int index);
281  int indexOfTopLevelItem(QTreeWidgetItem *item); // ### Qt 5: remove me
282  int indexOfTopLevelItem(QTreeWidgetItem *item) const;
283 
284  void insertTopLevelItems(int index, const QList<QTreeWidgetItem*> &items);
285  void addTopLevelItems(const QList<QTreeWidgetItem*> &items);
286 
287  QTreeWidgetItem *headerItem() const;
288  void setHeaderItem(QTreeWidgetItem *item);
289  void setHeaderLabels(const QStringList &labels);
290  inline void setHeaderLabel(const QString &label);
291 
292  QTreeWidgetItem *currentItem() const;
293  int currentColumn() const;
294  void setCurrentItem(QTreeWidgetItem *item);
295  void setCurrentItem(QTreeWidgetItem *item, int column);
296  void setCurrentItem(QTreeWidgetItem *item, int column, QItemSelectionModel::SelectionFlags command);
297 
298  QTreeWidgetItem *itemAt(const QPoint &p) const;
299  inline QTreeWidgetItem *itemAt(int x, int y) const;
300  QRect visualItemRect(const QTreeWidgetItem *item) const;
301 
302  int sortColumn() const;
303  void sortItems(int column, Qt::SortOrder order);
304  void setSortingEnabled(bool enable);
305  bool isSortingEnabled() const;
306 
307  void editItem(QTreeWidgetItem *item, int column = 0);
308  void openPersistentEditor(QTreeWidgetItem *item, int column = 0);
309  void closePersistentEditor(QTreeWidgetItem *item, int column = 0);
310 
311  QWidget *itemWidget(QTreeWidgetItem *item, int column) const;
312  void setItemWidget(QTreeWidgetItem *item, int column, QWidget *widget);
313  inline void removeItemWidget(QTreeWidgetItem *item, int column);
314 
315  bool isItemSelected(const QTreeWidgetItem *item) const;
316  void setItemSelected(const QTreeWidgetItem *item, bool select);
317  QList<QTreeWidgetItem*> selectedItems() const;
318  QList<QTreeWidgetItem*> findItems(const QString &text, Qt::MatchFlags flags,
319  int column = 0) const;
320 
321  bool isItemHidden(const QTreeWidgetItem *item) const;
322  void setItemHidden(const QTreeWidgetItem *item, bool hide);
323 
324  bool isItemExpanded(const QTreeWidgetItem *item) const;
325  void setItemExpanded(const QTreeWidgetItem *item, bool expand);
326 
327  bool isFirstItemColumnSpanned(const QTreeWidgetItem *item) const;
328  void setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool span);
329 
330  QTreeWidgetItem *itemAbove(const QTreeWidgetItem *item) const;
331  QTreeWidgetItem *itemBelow(const QTreeWidgetItem *item) const;
332 
333  void setSelectionModel(QItemSelectionModel *selectionModel);
334 
335 public Q_SLOTS:
336  void scrollToItem(const QTreeWidgetItem *item,
337  QAbstractItemView::ScrollHint hint = EnsureVisible);
338  void expandItem(const QTreeWidgetItem *item);
339  void collapseItem(const QTreeWidgetItem *item);
340  void clear();
341 
342 Q_SIGNALS:
343  void itemPressed(QTreeWidgetItem *item, int column);
344  void itemClicked(QTreeWidgetItem *item, int column);
345  void itemDoubleClicked(QTreeWidgetItem *item, int column);
346  void itemActivated(QTreeWidgetItem *item, int column);
347  void itemEntered(QTreeWidgetItem *item, int column);
348  void itemChanged(QTreeWidgetItem *item, int column);
349  void itemExpanded(QTreeWidgetItem *item);
350  void itemCollapsed(QTreeWidgetItem *item);
351  void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
352  void itemSelectionChanged();
353 
354 protected:
355  bool event(QEvent *e);
356  virtual QStringList mimeTypes() const;
357  virtual QMimeData *mimeData(const QList<QTreeWidgetItem*> items) const;
358  virtual bool dropMimeData(QTreeWidgetItem *parent, int index,
359  const QMimeData *data, Qt::DropAction action);
360  virtual Qt::DropActions supportedDropActions() const;
361  QList<QTreeWidgetItem*> items(const QMimeData *data) const;
362 
363  QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const;
364  QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
365  void dropEvent(QDropEvent *event);
366 
367 private:
368  void setModel(QAbstractItemModel *model);
369 
372 
373  Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index))
374  Q_PRIVATE_SLOT(d_func(), void _q_emitItemClicked(const QModelIndex &index))
375  Q_PRIVATE_SLOT(d_func(), void _q_emitItemDoubleClicked(const QModelIndex &index))
376  Q_PRIVATE_SLOT(d_func(), void _q_emitItemActivated(const QModelIndex &index))
377  Q_PRIVATE_SLOT(d_func(), void _q_emitItemEntered(const QModelIndex &index))
378  Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex &index))
379  Q_PRIVATE_SLOT(d_func(), void _q_emitItemExpanded(const QModelIndex &index))
380  Q_PRIVATE_SLOT(d_func(), void _q_emitItemCollapsed(const QModelIndex &index))
381  Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex &current))
382  Q_PRIVATE_SLOT(d_func(), void _q_sort())
383  Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight))
384  Q_PRIVATE_SLOT(d_func(), void _q_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected))
385 };
386 
387 inline void QTreeWidget::removeItemWidget(QTreeWidgetItem *item, int column)
388 { setItemWidget(item, column, 0); }
389 
390 inline QTreeWidgetItem *QTreeWidget::itemAt(int ax, int ay) const
391 { return itemAt(QPoint(ax, ay)); }
392 
393 inline void QTreeWidget::setHeaderLabel(const QString &alabel)
394 { setHeaderLabels(QStringList(alabel)); }
395 
396 inline void QTreeWidgetItem::setSelected(bool aselect)
397 { if (view) view->setItemSelected(this, aselect); }
398 
399 inline bool QTreeWidgetItem::isSelected() const
400 { return (view ? view->isItemSelected(this) : false); }
401 
402 inline void QTreeWidgetItem::setHidden(bool ahide)
403 { if (view) view->setItemHidden(this, ahide); }
404 
405 inline bool QTreeWidgetItem::isHidden() const
406 { return (view ? view->isItemHidden(this) : false); }
407 
408 inline void QTreeWidgetItem::setExpanded(bool aexpand)
409 { if (view) view->setItemExpanded(this, aexpand); }
410 
411 inline bool QTreeWidgetItem::isExpanded() const
412 { return (view ? view->isItemExpanded(this) : false); }
413 
415 { if (view) view->setFirstItemColumnSpanned(this, aspan); }
416 
418 { return (view ? view->isFirstItemColumnSpanned(this) : false); }
419 
421 { setFlags(disabled ? (flags() & ~Qt::ItemIsEnabled) : flags() | Qt::ItemIsEnabled); }
422 
423 inline bool QTreeWidgetItem::isDisabled() const
424 { return !(flags() & Qt::ItemIsEnabled); }
425 
426 #endif // QT_NO_TREEWIDGET
427 
429 
431 
432 #endif // QTREEWIDGET_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
CheckState
Definition: qnamespace.h:1607
QTreeWidgetItem * itemAt(const QPoint &p) const
Returns a pointer to the item at the coordinates p.
void openPersistentEditor(const QModelIndex &index)
Opens a persistent editor on the item at the given index.
The QItemSelectionModel class keeps track of a view&#39;s selected items.
int type
Definition: qmetatype.cpp:239
void setFont(int column, const QFont &font)
Sets the font used to display the text in the given column to the given font.
Definition: qtreewidget.h:247
#define disabled
bool isExpanded() const
Returns true if the item is expanded, otherwise returns false.
Definition: qtreewidget.h:411
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &in, QTreeWidgetItem &item)
bool isItemSelected(const QTreeWidgetItem *item) const
Returns true if the item is selected; otherwise returns false.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
EventRef event
QPointer< QWidget > widget
#define QT_MODULE(x)
Definition: qglobal.h:2783
void setHeaderLabel(const QString &label)
Same as setHeaderLabels(QStringList(label)).
Definition: qtreewidget.h:393
void setText(int column, const QString &text)
Sets the text to be displayed in the given column to the given text.
Definition: qtreewidget.h:226
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
void setStatusTip(int column, const QString &statusTip)
Sets the status tip for the given column to the given statusTip.
Definition: qtreewidget.h:233
Qt::ItemFlags flags() const
Returns the flags used to describe the item.
The QTreeWidget class provides a tree view that uses a predefined tree model.
Definition: qtreewidget.h:260
void sortChildren(int column, Qt::SortOrder order, bool climb)
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
void setItemHidden(const QTreeWidgetItem *item, bool hide)
Hides the given item if hide is true; otherwise shows the item.
bool isHidden() const
Returns true if the item is hidden, otherwise returns false.
Definition: qtreewidget.h:405
int childCount() const
Returns the number of child items.
Definition: qtreewidget.h:190
void setTextColor(int column, const QColor &color)
This function is deprecated.
Definition: qtreewidget.h:154
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static void clear(QVariant::Private *d)
Definition: qvariant.cpp:197
void setCheckState(int column, Qt::CheckState state)
Sets the item in the given column check state to be state.
Definition: qtreewidget.h:164
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
void setSizeHint(int column, const QSize &size)
Sets the size hint for the tree item in the given column to be size.
Definition: qtreewidget.h:169
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
QColor textColor(int column) const
This function is deprecated.
Definition: qtreewidget.h:152
void setSelectionModel(QItemSelectionModel *selectionModel)
Reimplemented Function
Definition: qtreeview.cpp:277
#define Q_SLOTS
Definition: qobjectdefs.h:71
void setModel(QAbstractItemModel *model)
Reimplemented Function
Definition: qtreeview.cpp:223
The QString class provides a Unicode character string.
Definition: qstring.h:83
QTreeWidget * view
Definition: qtreewidget.h:219
QString whatsThis(int column) const
Returns the "What&#39;s This?" help for the contents of the given column.
Definition: qtreewidget.h:128
QString statusTip(int column) const
Returns the status tip for the contents of the given column.
Definition: qtreewidget.h:117
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
bool isDisabled() const
Returns true if the item is disabled; otherwise returns false.
Definition: qtreewidget.h:423
#define Q_SIGNALS
Definition: qobjectdefs.h:72
bool operator<(int priority, const QPair< QRunnable *, int > &p)
Definition: qthreadpool.cpp:50
void setBackgroundColor(int column, const QColor &color)
This function is deprecated.
Definition: qtreewidget.h:144
bool isFirstItemColumnSpanned(const QTreeWidgetItem *item) const
Returns true if the given item is set to show only one section over all columns; otherwise returns fa...
ItemType
This enum describes the types that are used to describe tree widget items.
Definition: qtreewidget.h:71
bool isFirstColumnSpanned() const
Returns true if the item is spanning all the columns in a row; otherwise returns false.
Definition: qtreewidget.h:417
Qt::CheckState checkState(int column) const
Returns the check state of the label in the given column.
Definition: qtreewidget.h:162
int textAlignment(int column) const
Returns the text alignment for the label in the given column (see Qt::AlignmentFlag).
Definition: qtreewidget.h:137
QSize sizeHint(int column) const
Returns the size hint set for the tree item in the given column (see QSize).
Definition: qtreewidget.h:167
void dropEvent(QDropEvent *event)
This function is called with the given event when a drop event occurs over the widget.
SortOrder
Definition: qnamespace.h:189
The QTreeWidgetItemIterator class provides a way to iterate over the items in a QTreeWidget instance...
QTreeWidgetItem * par
Definition: qtreewidget.h:221
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
int columnCount
the number of columns displayed in the tree widget
Definition: qtreewidget.h:263
QTreeWidgetItem * parent() const
Returns the item&#39;s parent.
Definition: qtreewidget.h:183
int type() const
Returns the type passed to the QTreeWidgetItem constructor.
Definition: qtreewidget.h:203
The QTreeView class provides a default model/view implementation of a tree view.
Definition: qtreeview.h:58
static bool setData(const QByteArray &data, STGMEDIUM *pmedium)
Definition: qmime_win.cpp:141
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QBrush foreground(int column) const
Returns the brush used to render the foreground (e.
Definition: qtreewidget.h:157
void setHidden(bool hide)
Hides the item if hide is true, otherwise shows the item.
Definition: qtreewidget.h:402
static const char * data(const QByteArray &arr)
QString toolTip(int column) const
Returns the tool tip for the given column.
Definition: qtreewidget.h:122
void setSortingEnabled(bool enable)
Definition: qtreeview.cpp:898
bool isItemExpanded(const QTreeWidgetItem *item) const
Returns true if the given item is open; otherwise returns false.
int topLevelItemCount
the number of top-level items
Definition: qtreewidget.h:264
DropAction
Definition: qnamespace.h:1597
QTreeWidgetItem::ChildIndicatorPolicy policy
void setExpanded(bool expand)
Expands the item if expand is true, otherwise collapses the item.
Definition: qtreewidget.h:408
quint16 values[128]
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
bool isSelected() const
Returns true if the item is selected, otherwise returns false.
Definition: qtreewidget.h:399
#define Q_OBJECT
Definition: qobjectdefs.h:157
void setBackground(int column, const QBrush &brush)
Sets the background brush of the label in the given column to the specified brush.
Definition: qtreewidget.h:149
The QAbstractItemModel class provides the abstract interface for item model classes.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QTreeWidgetItem class provides an item for use with the QTreeWidget convenience class...
Definition: qtreewidget.h:63
void sortChildren(int column, Qt::SortOrder order)
Sorts the children of the item using the given order, by the values in the given column.
Definition: qtreewidget.h:204
void setForeground(int column, const QBrush &brush)
Sets the foreground brush of the label in the given column to the specified brush.
Definition: qtreewidget.h:159
Qt::ItemFlags itemFlags
Definition: qtreewidget.h:223
bool isSortingEnabled() const
Definition: qtreeview.cpp:916
QTreeWidgetItem * child(int index) const
Returns the item at the given index in the list of the item&#39;s children.
Definition: qtreewidget.h:184
The QItemSelection class manages information about selected items in a model.
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
Definition: qevent.h:476
void setFlags(Qt::ItemFlags flags)
Sets the flags for the item to the given flags.
QColor backgroundColor(int column) const
This function is deprecated.
Definition: qtreewidget.h:142
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setItemSelected(const QTreeWidgetItem *item, bool select)
If select is true, the given item is selected; otherwise it is deselected.
QTreeWidgetItemPrivate * d
Definition: qtreewidget.h:220
void setWhatsThis(int column, const QString &whatsThis)
Sets the "What&#39;s This?" help for the given column to whatsThis.
Definition: qtreewidget.h:243
QString text(int column) const
Returns the text in the specified column.
Definition: qtreewidget.h:109
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QModelIndex class is used to locate data in a data model.
void setDisabled(bool disabled)
Disables the item if disabled is true; otherwise enables the item.
Definition: qtreewidget.h:420
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QVector< QVector< QWidgetItemData > > values
Definition: qtreewidget.h:218
void setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool span)
Sets the given item to only show one section for all columns if span is true; otherwise the item will...
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
void setToolTip(int column, const QString &toolTip)
Sets the tooltip for the given column to toolTip.
Definition: qtreewidget.h:238
void setSelected(bool select)
Sets the selected state of the item to select.
Definition: qtreewidget.h:396
void setTextAlignment(int column, int alignment)
Sets the text alignment for the label in the given column to the alignment specified (see Qt::Alignme...
Definition: qtreewidget.h:139
quint16 index
void setIcon(int column, const QIcon &icon)
Sets the icon to be displayed in the given column to icon.
Definition: qtreewidget.h:229
friend class QTreeWidget
Definition: qtreewidget.h:66
int indexOfChild(QTreeWidgetItem *child) const
Returns the index of the given child in the item&#39;s list of children.
Definition: qtreewidget.h:250
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QBrush background(int column) const
Returns the brush used to render the background of the specified column.
Definition: qtreewidget.h:147
Q_GUI_EXPORT QDataStream & operator<<(QDataStream &out, const QTreeWidgetItem &item)
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
void setItemExpanded(const QTreeWidgetItem *item, bool expand)
Sets the item referred to by item to either closed or opened, depending on the value of expand...
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
void closePersistentEditor(const QModelIndex &index)
Closes the persistent editor for the item at the given index.
QList< QTreeWidgetItem * > children
Definition: qtreewidget.h:222
QIcon icon(int column) const
Returns the icon that is displayed in the specified column.
Definition: qtreewidget.h:113
void setFirstColumnSpanned(bool span)
Sets the first section to span all columns if span is true; otherwise all item sections are shown...
Definition: qtreewidget.h:414
bool event(QEvent *event)
Reimplemented Function
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define QT_END_HEADER
Definition: qglobal.h:137
int columnCount() const
Returns the number of columns in the item.
Definition: qtreewidget.h:191
QFont font(int column) const
Returns the font used to render the text in the specified column.
Definition: qtreewidget.h:133
QTreeWidget * treeWidget() const
Returns the tree widget that contains the item.
Definition: qtreewidget.h:85
#define text
Definition: qobjectdefs.h:80
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static void clone(QMetaObjectBuilder &builder, const QMetaObject *mo, const QMetaObject *ignoreStart, const QMetaObject *ignoreEnd)
bool isItemHidden(const QTreeWidgetItem *item) const
Returns true if the item is explicitly hidden, otherwise returns false.
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60