Class: QgsTreeWidgetItem¶
- class qgis.gui.QgsTreeWidgetItem¶
Bases:
PyQt5.QtWidgets.QTreeWidgetItem
QTreeWidgetItem subclass with custom handling for item sorting.
QgsTreeWidgetItem
allows for items to be sorted using a specified user role, and also correctly handles sorting numeric or mixed text and numeric values.New in version 3.0.
QgsTreeWidgetItem(view: QTreeWidget, type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
view – parent QTreeWidget view
type – item type
QgsTreeWidgetItem(type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
type – item type
QgsTreeWidgetItem(strings: Iterable[str], type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
strings – list of strings containing text for each column in the item
type – item type
QgsTreeWidgetItem(view: QTreeWidget, strings: Iterable[str], type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
view – parent QTreeWidget view
strings – list of strings containing text for each column in the item
type – item type
QgsTreeWidgetItem(view: QTreeWidget, after: QTreeWidgetItem, type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
view – parent QTreeWidget view
after – QTreeWidgetItem to place insert item after in the view
type – item type
QgsTreeWidgetItem(parent: QTreeWidgetItem, type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
parent – QTreeWidgetItem item
type – item type
QgsTreeWidgetItem(parent: QTreeWidgetItem, strings: Iterable[str], type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
parent – QTreeWidgetItem item
strings – list of strings containing text for each column in the item
type – item type
QgsTreeWidgetItem(parent: QTreeWidgetItem, after: QTreeWidgetItem, type: int = QTreeWidgetItem.Type) Constructor for QgsTreeWidgetItem
- Parameters
parent – QTreeWidgetItem item
after – QTreeWidgetItem to place insert item after in the view
type – item type
QgsTreeWidgetItem(
QgsTreeWidgetItem
)Methods
Returns the item's priority when it is set to show always on top.
Sets a the item to display always on top of other items in the widget, regardless of the sort column and sort or display value for the item.
Sets the custom sort data for a specified column.
Returns the custom sort data for a specified column.
- alwaysOnTopPriority(self) int ¶
Returns the item’s priority when it is set to show always on top. Items with a lower priority will be placed above items with a higher priority.
- Return type
int
- Returns
priority, or -1 if item is not set to show always on top
See also
- emitDataChanged(self)¶
- setAlwaysOnTopPriority(self, priority: int)¶
Sets a the item to display always on top of other items in the widget, regardless of the sort column and sort or display value for the item.
- Parameters
priority (int) – priority for sorting always on top items. Items with a lower priority will be placed above items with a higher priority.
See also
- setSortData(self, column: int, value: Any)¶
Sets the custom sort data for a specified column. If set, this value will be used when sorting the item instead of the item’s display text. If not set, the item’s display text will be used when sorting.
- Parameters
column (int) – column index
value (Any) – sort value
See also
- sortData(self, column: int) Any ¶
Returns the custom sort data for a specified column. If set, this value will be used when sorting the item instead of the item’s display text. If not set, the item’s display text will be used when sorting.
See also
- Parameters
column (int) –
- Return type
Any