QGIS API Documentation 3.41.0-Master (cea29feecf2)
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:
43 explicit QgsTreeWidgetItem( QTreeWidget *view SIP_TRANSFERTHIS, int type = Type );
44
49 explicit QgsTreeWidgetItem( int type = Type );
50
56 QgsTreeWidgetItem( const QStringList &strings, int type = Type );
57
64 QgsTreeWidgetItem( QTreeWidget *view SIP_TRANSFERTHIS, const QStringList &strings, int type = Type );
65
72 QgsTreeWidgetItem( QTreeWidget *view SIP_TRANSFERTHIS, QTreeWidgetItem *after, int type = Type );
73
79 explicit QgsTreeWidgetItem( QTreeWidgetItem *parent SIP_TRANSFERTHIS, int type = Type );
80
87 QgsTreeWidgetItem( QTreeWidgetItem *parent SIP_TRANSFERTHIS, const QStringList &strings, int type = Type );
88
95 QgsTreeWidgetItem( QTreeWidgetItem *parent SIP_TRANSFERTHIS, QTreeWidgetItem *after, int type = Type );
96
105 void setSortData( int column, const QVariant &value );
106
113 QVariant sortData( int column ) const;
114
122 void setAlwaysOnTopPriority( int priority );
123
130 int alwaysOnTopPriority() const;
131
136 bool operator<( const QTreeWidgetItem &other ) const override;
137
142 bool operator>=( const QTreeWidgetItem &other ) const { return !( *this < other ); }
143
144 private:
145 enum ItemDataRole
146 {
147 CustomSortRole = Qt::UserRole + 1001,
148 AlwaysOnTopPriorityRole = Qt::UserRole + 1002,
149 };
150};
151
157class GUI_EXPORT QgsTreeWidgetItemObject : public QObject, public QgsTreeWidgetItem
158{
159 Q_OBJECT
160
161 public:
166 explicit QgsTreeWidgetItemObject( int type = Type );
167
169 explicit QgsTreeWidgetItemObject( QTreeWidget *parent SIP_TRANSFERTHIS, int type = Type );
170
172 void setData( int column, int role, const QVariant &value ) override;
173
174 signals:
176 void itemEdited( QTreeWidgetItem *item, int column );
177};
178
179#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:6425
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53