QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | List of all members
QgsTreeWidgetItem Class Reference

QTreeWidgetItem subclass with custom handling for item sorting. More...

#include <qgstreewidgetitem.h>

Inheritance diagram for QgsTreeWidgetItem:
Inheritance graph
[legend]

Public Member Functions

 QgsTreeWidgetItem (const QStringList &strings, int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
 QgsTreeWidgetItem (int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
 QgsTreeWidgetItem (QTreeWidget *view, const QStringList &strings, int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
 QgsTreeWidgetItem (QTreeWidget *view, int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
 QgsTreeWidgetItem (QTreeWidget *view, QTreeWidgetItem *after, int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
 QgsTreeWidgetItem (QTreeWidgetItem *parent, const QStringList &strings, int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
 QgsTreeWidgetItem (QTreeWidgetItem *parent, int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
 QgsTreeWidgetItem (QTreeWidgetItem *parent, QTreeWidgetItem *after, int type=Type)
 Constructor for QgsTreeWidgetItem. More...
 
int alwaysOnTopPriority () const
 Returns the item's priority when it is set to show always on top. More...
 
bool operator< (const QTreeWidgetItem &other) const override
 Returns true if this item should appear before another item when sorting a list of items. More...
 
bool operator>= (const QTreeWidgetItem &other) const
 Returns true if this item should appear after another item when sorting a list of items. More...
 
void setAlwaysOnTopPriority (int priority)
 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. More...
 
void setSortData (int column, const QVariant &value)
 Sets the custom sort data for a specified column. More...
 
QVariant sortData (int column) const
 Returns the custom sort data for a specified column. More...
 

Detailed Description

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.

Definition at line 35 of file qgstreewidgetitem.h.

Constructor & Destructor Documentation

◆ QgsTreeWidgetItem() [1/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( QTreeWidget *  view,
int  type = Type 
)
explicit

Constructor for QgsTreeWidgetItem.

Parameters
viewparent QTreeWidget view
typeitem type

Definition at line 22 of file qgstreewidgetitem.cpp.

◆ QgsTreeWidgetItem() [2/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( int  type = Type)
explicit

Constructor for QgsTreeWidgetItem.

Parameters
typeitem type

Definition at line 26 of file qgstreewidgetitem.cpp.

◆ QgsTreeWidgetItem() [3/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( const QStringList &  strings,
int  type = Type 
)

Constructor for QgsTreeWidgetItem.

Parameters
stringslist of strings containing text for each column in the item
typeitem type

Definition at line 30 of file qgstreewidgetitem.cpp.

◆ QgsTreeWidgetItem() [4/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( QTreeWidget *  view,
const QStringList &  strings,
int  type = Type 
)

Constructor for QgsTreeWidgetItem.

Parameters
viewparent QTreeWidget view
stringslist of strings containing text for each column in the item
typeitem type

Definition at line 34 of file qgstreewidgetitem.cpp.

◆ QgsTreeWidgetItem() [5/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( QTreeWidget *  view,
QTreeWidgetItem *  after,
int  type = Type 
)

Constructor for QgsTreeWidgetItem.

Parameters
viewparent QTreeWidget view
afterQTreeWidgetItem to place insert item after in the view
typeitem type

Definition at line 38 of file qgstreewidgetitem.cpp.

◆ QgsTreeWidgetItem() [6/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( QTreeWidgetItem *  parent,
int  type = Type 
)
explicit

Constructor for QgsTreeWidgetItem.

Parameters
parentQTreeWidgetItem item
typeitem type

Definition at line 42 of file qgstreewidgetitem.cpp.

◆ QgsTreeWidgetItem() [7/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( QTreeWidgetItem *  parent,
const QStringList &  strings,
int  type = Type 
)

Constructor for QgsTreeWidgetItem.

Parameters
parentQTreeWidgetItem item
stringslist of strings containing text for each column in the item
typeitem type

Definition at line 46 of file qgstreewidgetitem.cpp.

◆ QgsTreeWidgetItem() [8/8]

QgsTreeWidgetItem::QgsTreeWidgetItem ( QTreeWidgetItem *  parent,
QTreeWidgetItem *  after,
int  type = Type 
)

Constructor for QgsTreeWidgetItem.

Parameters
parentQTreeWidgetItem item
afterQTreeWidgetItem to place insert item after in the view
typeitem type

Definition at line 50 of file qgstreewidgetitem.cpp.

Member Function Documentation

◆ alwaysOnTopPriority()

int QgsTreeWidgetItem::alwaysOnTopPriority ( ) const

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
See also
setAlwaysOnTopPriority()

Definition at line 69 of file qgstreewidgetitem.cpp.

◆ operator<()

bool QgsTreeWidgetItem::operator< ( const QTreeWidgetItem &  other) const
override

Returns true if this item should appear before another item when sorting a list of items.

Definition at line 75 of file qgstreewidgetitem.cpp.

◆ operator>=()

bool QgsTreeWidgetItem::operator>= ( const QTreeWidgetItem &  other) const
inline

Returns true if this item should appear after another item when sorting a list of items.

Definition at line 143 of file qgstreewidgetitem.h.

◆ setAlwaysOnTopPriority()

void QgsTreeWidgetItem::setAlwaysOnTopPriority ( int  priority)

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
prioritypriority for sorting always on top items. Items with a lower priority will be placed above items with a higher priority.
See also
alwaysOnTopPriority()

Definition at line 64 of file qgstreewidgetitem.cpp.

◆ setSortData()

void QgsTreeWidgetItem::setSortData ( int  column,
const QVariant &  value 
)

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
columncolumn index
valuesort value
See also
sortData()

Definition at line 54 of file qgstreewidgetitem.cpp.

◆ sortData()

QVariant QgsTreeWidgetItem::sortData ( int  column) const

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()

Definition at line 59 of file qgstreewidgetitem.cpp.


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