QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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 <QTreeWidgetItem>
23#include "qgis_sip.h"
24#include <QObject>
25#include "qgis_gui.h"
26
35class GUI_EXPORT QgsTreeWidgetItem : public QTreeWidgetItem
36{
37 public:
38
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
147 enum ItemDataRole
148 {
149 CustomSortRole = Qt::UserRole + 1001,
150 AlwaysOnTopPriorityRole = Qt::UserRole + 1002,
151 };
152
153};
154
160class GUI_EXPORT QgsTreeWidgetItemObject: public QObject, public QgsTreeWidgetItem
161{
162 Q_OBJECT
163
164 public:
165
170 explicit QgsTreeWidgetItemObject( int type = Type );
171
173 explicit QgsTreeWidgetItemObject( QTreeWidget *parent SIP_TRANSFERTHIS, int type = Type );
174
176 void setData( int column, int role, const QVariant &value ) override;
177
178 signals:
180 void itemEdited( QTreeWidgetItem *item, int column );
181};
182
183#endif // QGSTREEWIDGETITEM_H
Custom QgsTreeWidgetItem with extra signals when item is edited.
void itemEdited(QTreeWidgetItem *item, int column)
Emitted when the contents of the column in the specified item has been edited by the user.
QTreeWidgetItem subclass with custom handling for item sorting.
bool operator>=(const QTreeWidgetItem &other) const
Returns true if this item should appear after another item when sorting a list of items.
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:6359
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53