Class: QgsTreeWidgetItem

class qgis.gui.QgsTreeWidgetItem(view: QTreeWidget, type: int = QTreeWidgetItem.Type)

Bases: PyQt5.QtWidgets.QTreeWidgetItem

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)

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: Enums

Methods

alwaysOnTopPriority Returns the item’s priority when it is set to show always on top.
emitDataChanged
setAlwaysOnTopPriority 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.
setSortData Sets the custom sort data for a specified column.
sortData Returns the custom sort data for a specified column.

Signals

Attributes

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.

Returns:priority, or -1 if item is not set to show always on top
emitDataChanged()
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 – priority for sorting always on top items. Items with a lower priority will be placed above items with a higher priority.
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 – column index
  • value – sort value

See also

sortData()

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

setSortData()