Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The QTreeWidgetItem class provides an item for use with the QTreeWidget convenience class. More...
#include <QTreeWidgetItem>
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:
QTreeWidgetItem *cities = new QTreeWidgetItem(treeWidget); cities->setText(0, tr("Cities")); QTreeWidgetItem *osloItem = new QTreeWidgetItem(cities); osloItem->setText(0, tr("Oslo")); osloItem->setText(1, tr("Yes"));
Items can be added in a particular order by specifying the item they follow when they are constructed:
QTreeWidgetItem *planets = new QTreeWidgetItem(treeWidget, cities); planets->setText(0, tr("Planets"));
Each column in an item can have its own background color which is set with the setBackgroundColor() function. The current background color can be found with backgroundColor(). The text label for each column can be rendered with its own font and text color. These are specified with the setFont() and setTextColor() functions, and read with font() and textColor().
The main difference between top-level items and those in lower levels of the tree is that a top-level item has no parent(). This information can be used to tell the difference between items, and is useful to know when inserting and removing items from the tree. Children of an item can be removed with takeChild() and inserted at a given index in the list of children with the insertChild() function.
By default, items are enabled, selectable, checkable, and can be the source of a drag and drop operation. Each item's flags can be changed by calling setFlags() with the appropriate value (see Qt::ItemFlags). Checkable items can be checked and unchecked with the setChecked() function. The corresponding checked() function indicates whether the item is currently checked.
See also QTreeWidget, Model/View Programming, QListWidgetItem, and QTableWidgetItem.
Constructs a tree widget item of the specified type. The item must be inserted into a tree widget.
See also type().
Constructs a tree widget item of the specified type. The item must be inserted into a tree widget. The given list of strings will be set as the item text for each column in the item.
See also type().
Constructs a tree widget item of the specified type and appends it to the items in the given parent.
See also type().
Constructs a tree widget item of the specified type and appends it to the items in the given parent. The given list of strings will be set as the item text for each column in the item.
See also type().
Constructs a tree widget item of the specified type and inserts it into the given parent after the preceding item.
See also type().
Constructs a tree widget item and append it to the given parent.
See also type().
Constructs a tree widget item and append it to the given parent. The given list of strings will be set as the item text for each column in the item.
See also type().
Constructs a tree widget item of the specified type that is inserted into the parent after the preceding child item.
See also type().
Constructs a copy of other. Note that type() and treeWidget() are not copied.
This function is useful when reimplementing clone().
This function was introduced in Qt 4.1.
Destroys this tree widget item.
Appends the child item to the list of children.
See also insertChild() and takeChild().
Appends the given list of children to the item.
This function was introduced in Qt 4.1.
See also insertChildren() and takeChildren().
Returns the color used to render the background of the specified column.
See also textColor() and setBackgroundColor().
Returns the check state of the label in the given column.
See also setCheckState() and Qt::CheckState.
Returns the item at the given index in the list of the item's children.
See also parent().
Returns the number of child items.
Creates a deep copy of the item and of its children.
Returns the number of columns in the item.
Returns the value for the item's column and role.
See also setData().
Returns the flags used to describe the item. These determine whether the item can be checked, edited, and selected.
The default value for flags is Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled. If the item was constructed with a parent, flags will in addition contain Qt::ItemIsDropEnabled.
See also setFlags().
Returns the font used to render the text in the specified column.
See also setFont().
Returns the icon that is displayed in the specified column.
See also setIcon().
Returns the index of the given child in the item's list of children.
Inserts the child item at index in the list of children.
Inserts the given list of children into the list of the item children at index .
This function was introduced in Qt 4.1.
Returns the item's parent.
See also child().
Reads the item from stream in. This only reads data into a single item.
See also write().
Sets the background color of the label in the given column to the specified color.
See also backgroundColor() and setTextColor().
Sets the item in the given column check state to be state.
See also checkState().
Sets the value for the item's column and role to the given value.
See also data().
Sets the flags for the item to the given flags. These determine whether the item can be selected or modified.
See also flags().
Sets the font used to display the text in the given column to the given font.
See also font(), setText(), and setTextColor().
Sets the icon to be displayed in the given column to icon.
See also icon() and setText().
Sets the size hint for the tree item in the given column to be size. If no size hint is set, the item delegate will compute the size hint based on the item data.
This function was introduced in Qt 4.1.
See also sizeHint().
Sets the status tip for the given column to the given statusTip. QTreeWidget mouse tracking needs to be enabled for this feature to work.
See also statusTip(), setToolTip(), and setWhatsThis().
Sets the text to be displayed in the given column to the given text.
See also text(), setFont(), and setTextColor().
Sets the text alignment for the label in the given column to the alignment specified (see Qt::AlignmentFlag).
See also textAlignment().
Sets the color used to display the text in the given column to color.
See also textColor(), setFont(), and setText().
Sets the tooltip for the given column to toolTip.
See also toolTip(), setStatusTip(), and setWhatsThis().
Sets the "What's This?" help for the given column to whatsThis.
See also whatsThis(), setStatusTip(), and setToolTip().
Returns the size hint set for the tree item in the given column (see QSize).
This function was introduced in Qt 4.1.
See also setSizeHint().
Returns the status tip for the contents of the given column.
See also setStatusTip().
Removes the item at index and returns it, otherwise return 0.
Removes the list of children and returns it, otherwise return an empty list.
This function was introduced in Qt 4.1.
Returns the text in the specified column.
See also setText().
Returns the text alignment for the label in the given column (see Qt::AlignmentFlag).
See also setTextAlignment().
Returns the color used to render the text in the specified column.
See also backgroundColor() and setTextColor().
Returns the tool tip for the given column.
See also setToolTip().
Returns the tree widget that contains the item.
Returns the type passed to the QTreeWidgetItem constructor.
Returns the "What's This?" help for the contents of the given column.
See also setWhatsThis().
Writes the item to stream out. This only writes data from one single item.
See also read().
Returns true if the text in the item is less than the text in the other item, otherwise returns false.
Assigns other's data and flags to this item. Note that type() and treeWidget() are not copied.
This function is useful when reimplementing clone().
The default type for tree widget items.
The minimum value for custom types. Values below UserType are reserved by Qt.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Writes the tree widget item item to stream out.
This operator uses QTreeWidgetItem::write().
See also Format of the QDataStream Operators.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Reads a tree widget item from stream in into item.
This operator uses QTreeWidgetItem::read().
See also Format of the QDataStream Operators.
Copyright © 2005 Trolltech | Trademarks | Qt 4.1.0 |