The QTreeWidgetItem class provides an item for use with the QTreeWidget convenience class.
Tree widget items are used to hold rows of information for tree widgets. Rows usually contain several columns of data, each of which can contain a text label and an icon.
The QTreeWidgetItem class is a convenience class that replaces the QListViewItem class in Qt 3. It provides an item for use with the QTreeWidget class.
Items are usually constructed with a parent that is either a QTreeWidget (for top-level items) or a QTreeWidgetItem (for items on lower levels of the tree).
For example, the following code constructs a top-level item to represent cities of the world, and adds a entry for Oslo as a child item:
cities->setText(0, tr("Cities"));
osloItem->setText(0, tr("Oslo")); //Column 1
osloItem->setText(1, tr("Yes")); //Column 2
QTreeWidgetItem *cities = new QTreeWidgetItem(treeWidget);
cities->setText(0, tr("Cities"));
QTreeWidgetItem *osloItem = new QTreeWidgetItem(cities);
osloItem->setText(0, tr("Oslo")); //Column 1
osloItem->setText(1, tr("Yes")); //Column 2
To copy to clipboard, switch view to plain text mode
Bookmarks