23 : QTreeWidgetItem( parent, type )
27 : QTreeWidgetItem( type )
31 : QTreeWidgetItem( strings, type )
35 : QTreeWidgetItem( view, strings, type )
39 : QTreeWidgetItem( view, after, type )
43 : QTreeWidgetItem( parent, type )
47 : QTreeWidgetItem( parent, strings, type )
51 : QTreeWidgetItem( parent, after, type )
56 setData( column, CustomSortRole, value );
61 return data( column, CustomSortRole );
66 setData( 0, AlwaysOnTopPriorityRole, priority );
71 const QVariant val = data( 0, AlwaysOnTopPriorityRole );
72 return val.isValid() ? val.toInt() : -1;
77 const int column = treeWidget()->sortColumn();
81 const QVariant priority1 = data( 0, AlwaysOnTopPriorityRole );
82 const QVariant priority2 = other.data( 0, AlwaysOnTopPriorityRole );
83 if ( priority1.isValid() && priority2.isValid() )
85 const int i1 = priority1.toInt();
86 const int i2 = priority2.toInt();
88 return priority1.toInt() < priority2.toInt();
90 else if ( priority1.isValid() )
94 else if ( priority2.isValid() )
103 QVariant val1 = data( column, CustomSortRole );
104 if ( !val1.isValid() )
105 val1 = text( column );
106 QVariant val2 = other.data( column, CustomSortRole );
107 if ( !val2.isValid() )
108 val2 = other.text( column );
112 val = val1.toDouble( &ok1 ) < val2.toDouble( &ok2 );
117 else if ( ok1 || ok2 )
142 QgsTreeWidgetItem::setData( column, role, value );
143 if ( role == Qt::EditRole )
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.