QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgstablewidgetitem.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgstablewidgetitem.cpp - QgsTableWidgetItem
3 
4  ---------------------
5  begin : 27.3.2016
6  copyright : (C) 2016 by Matthias Kuhn, OPENGIS.ch
7  email : [email protected]
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #include "qgstablewidgetitem.h"
17 
20  , mSortRole( Qt::DisplayRole )
21 {
22 }
23 
25  : QTableWidgetItem( text )
26  , mSortRole( Qt::DisplayRole )
27 {
28 }
29 
31 {
32  mSortRole = role;
33 }
34 
36 {
37  return mSortRole;
38 }
39 
41 {
42 #if QT_VERSION < 0x050000
43  return data( mSortRole ).toString() < other.data( mSortRole ).toString();
44 #else
45  return data( mSortRole ) < other.data( mSortRole );
46 #endif
47 }
int sortRole() const
Get the role by which the items should be sorted.
virtual QVariant data(int role) const
void setSortRole(int role)
Set the role by which the items should be sorted.
QString text() const
bool operator<(const QTableWidgetItem &other) const override
QString toString() const