Qt 4.8
Public Functions | Public Variables | List of all members
QTreeWidgetItemPrivate Class Reference

#include <qtreewidget_p.h>

Public Functions

void propagateDisabled (QTreeWidgetItem *item)
 
 QTreeWidgetItemPrivate (QTreeWidgetItem *item)
 
void sortChildren (int column, Qt::SortOrder order, bool climb)
 

Public Variables

uint disabled: 1
 
QVariantList display
 
QTreeWidgetItem::ChildIndicatorPolicy policy
 
QTreeWidgetItemq
 
int rowGuess
 
uint selected: 1
 

Detailed Description

Definition at line 187 of file qtreewidget_p.h.

Constructors and Destructors

◆ QTreeWidgetItemPrivate()

QTreeWidgetItemPrivate::QTreeWidgetItemPrivate ( QTreeWidgetItem item)
inline

Functions

◆ propagateDisabled()

void QTreeWidgetItemPrivate::propagateDisabled ( QTreeWidgetItem item)

Definition at line 1829 of file qtreewidget.cpp.

Referenced by QTreeWidgetItem::insertChild(), QTreeWidgetItem::insertChildren(), QTreeWidgetItem::takeChild(), and QTreeWidgetItem::takeChildren().

1830 {
1831  Q_ASSERT(item);
1832  const bool enable = item->par ? (item->par->itemFlags.testFlag(Qt::ItemIsEnabled)) : true;
1833 
1834  QStack<QTreeWidgetItem*> parents;
1835  parents.push(item);
1836  while (!parents.isEmpty()) {
1837  QTreeWidgetItem *parent = parents.pop();
1838  if (!parent->d->disabled) { // if not explicitly disabled
1839  Qt::ItemFlags oldFlags = parent->itemFlags;
1840  if (enable)
1841  parent->itemFlags = parent->itemFlags | Qt::ItemIsEnabled;
1842  else
1843  parent->itemFlags = parent->itemFlags & ~Qt::ItemIsEnabled;
1844  if (parent->itemFlags != oldFlags)
1845  parent->itemChanged();
1846  }
1847 
1848  for (int i = 0; i < parent->children.count(); ++i) {
1849  QTreeWidgetItem *child = parent->children.at(i);
1850  parents.push(child);
1851  }
1852  }
1853 }
The QStack class is a template class that provides a stack.
Definition: qcontainerfwd.h:63
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
T pop()
Removes the top item from the stack and returns it.
Definition: qstack.h:67
QTreeWidgetItem * par
Definition: qtreewidget.h:221
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void push(const T &t)
Adds element t to the top of the stack.
Definition: qstack.h:60
The QTreeWidgetItem class provides an item for use with the QTreeWidget convenience class...
Definition: qtreewidget.h:63
Qt::ItemFlags itemFlags
Definition: qtreewidget.h:223
QTreeWidgetItemPrivate * d
Definition: qtreewidget.h:220
Definition: qnamespace.h:54
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139
QList< QTreeWidgetItem * > children
Definition: qtreewidget.h:222

◆ sortChildren()

void QTreeWidgetItemPrivate::sortChildren ( int  column,
Qt::SortOrder  order,
bool  climb 
)

Definition at line 2282 of file qtreewidget.cpp.

Referenced by QTreeWidgetItem::sortChildren().

2283 {
2284  QTreeModel *model = (q->view ? qobject_cast<QTreeModel*>(q->view->model()) : 0);
2285  if (!model)
2286  return;
2287  model->sortItems(&q->children, column, order);
2288  if (climb) {
2290  for (; it != q->children.end(); ++it) {
2291  //here we call the private object's method to avoid emitting
2292  //the layoutAboutToBeChanged and layoutChanged signals
2293  (*it)->d->sortChildren(column, order, climb);
2294  }
2295  }
2296 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
#define it(className, varName)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
QTreeWidget * view
Definition: qtreewidget.h:219
QTreeWidgetItem * q
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
QList< QTreeWidgetItem * > children
Definition: qtreewidget.h:222
QAbstractItemModel * model() const
Returns the model that this view is presenting.
void sortItems(QList< QTreeWidgetItem *> *items, int column, Qt::SortOrder order)

Properties

◆ disabled

uint QTreeWidgetItemPrivate::disabled

Definition at line 196 of file qtreewidget_p.h.

Referenced by propagateDisabled(), and QTreeWidgetItem::setFlags().

◆ display

QVariantList QTreeWidgetItemPrivate::display

◆ policy

QTreeWidgetItem::ChildIndicatorPolicy QTreeWidgetItemPrivate::policy

◆ q

QTreeWidgetItem* QTreeWidgetItemPrivate::q

Definition at line 194 of file qtreewidget_p.h.

◆ rowGuess

int QTreeWidgetItemPrivate::rowGuess

Definition at line 198 of file qtreewidget_p.h.

Referenced by QTreeWidgetItem::addChild(), and QTreeModel::index().

◆ selected

uint QTreeWidgetItemPrivate::selected

The documentation for this class was generated from the following files: