QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgstreewidgetitem.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstreewidgetitem.h
3 -------------------
4 begin : 06 Nov, 2005
5 copyright : (C) 2005 by Brendan Morley
6 email : morb at ozemail dot com dot au
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18
19#ifndef QGSTREEWIDGETITEM_H
20#define QGSTREEWIDGETITEM_H
21
22#include "qgis_gui.h"
23#include "qgis_sip.h"
24
25#include <QObject>
26#include <QTreeWidgetItem>
27
36class GUI_EXPORT QgsTreeWidgetItem : public QTreeWidgetItem
37{
38 public:
44 explicit QgsTreeWidgetItem( QTreeWidget *view SIP_TRANSFERTHIS, int type = Type );
45
50 explicit QgsTreeWidgetItem( int type = Type );
51
57 QgsTreeWidgetItem( const QStringList &strings, int type = Type );
58
65 QgsTreeWidgetItem( QTreeWidget *view SIP_TRANSFERTHIS, const QStringList &strings, int type = Type );
66
73 QgsTreeWidgetItem( QTreeWidget *view SIP_TRANSFERTHIS, QTreeWidgetItem *after, int type = Type );
74
80 explicit QgsTreeWidgetItem( QTreeWidgetItem *parent SIP_TRANSFERTHIS, int type = Type );
81
88 QgsTreeWidgetItem( QTreeWidgetItem *parent SIP_TRANSFERTHIS, const QStringList &strings, int type = Type );
89
96 QgsTreeWidgetItem( QTreeWidgetItem *parent SIP_TRANSFERTHIS, QTreeWidgetItem *after, int type = Type );
97
106 void setSortData( int column, const QVariant &value );
107
114 QVariant sortData( int column ) const;
115
123 void setAlwaysOnTopPriority( int priority );
124
131 int alwaysOnTopPriority() const;
132
137 bool operator<( const QTreeWidgetItem &other ) const override;
138
143 bool operator>=( const QTreeWidgetItem &other ) const { return !( *this < other ); }
144
145 private:
146 enum ItemDataRole
147 {
148 CustomSortRole = Qt::UserRole + 1001,
149 AlwaysOnTopPriorityRole = Qt::UserRole + 1002,
150 };
151};
152
158class GUI_EXPORT QgsTreeWidgetItemObject : public QObject, public QgsTreeWidgetItem
159{
160 Q_OBJECT
161
162 public:
167 explicit QgsTreeWidgetItemObject( int type = Type );
168
170 explicit QgsTreeWidgetItemObject( QTreeWidget *parent SIP_TRANSFERTHIS, int type = Type );
171
173 void setData( int column, int role, const QVariant &value ) override;
174
175 signals:
177 void itemEdited( QTreeWidgetItem *item, int column );
178};
179
180#endif // QGSTREEWIDGETITEM_H
void itemEdited(QTreeWidgetItem *item, int column)
Emitted when the contents of the column in the specified item has been edited by the user.
QgsTreeWidgetItemObject(int type=Type)
Constructor for QgsTreeWidgetItemObject.
void setData(int column, int role, const QVariant &value) override
Sets the value for the item's column and role to the given value.
void setAlwaysOnTopPriority(int priority)
Sets a the item to display always on top of other items in the widget, regardless of the sort column ...
bool operator>=(const QTreeWidgetItem &other) const
Returns true if this item should appear after another item when sorting a list of items.
int alwaysOnTopPriority() const
Returns the item's priority when it is set to show always on top.
void setSortData(int column, const QVariant &value)
Sets the custom sort data for a specified column.
QVariant sortData(int column) const
Returns the custom sort data for a specified column.
QgsTreeWidgetItem(QTreeWidget *view, int type=Type)
Constructor for QgsTreeWidgetItem.
bool operator<(const QVariant &v1, const QVariant &v2)
Compares two QVariant values and returns whether the first is less than the second.
Definition qgis.h:7039
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53