22 : QTreeWidgetItem( parent, type )
26 : QTreeWidgetItem( type )
30 : QTreeWidgetItem( strings, type )
34 : QTreeWidgetItem( view, strings, type )
38 : QTreeWidgetItem( view, after, type )
42 : QTreeWidgetItem( parent, type )
46 : QTreeWidgetItem( parent, strings, type )
50 : QTreeWidgetItem( parent, after, type )
55 setData( column, CustomSortRole, value );
60 return data( column, CustomSortRole );
65 setData( 0, AlwaysOnTopPriorityRole, priority );
70 const QVariant val = data( 0, AlwaysOnTopPriorityRole );
71 return val.isValid() ? val.toInt() : -1;
76 const int column = treeWidget()->sortColumn();
80 const QVariant priority1 = data( 0, AlwaysOnTopPriorityRole );
81 const QVariant priority2 = other.data( 0, AlwaysOnTopPriorityRole );
82 if ( priority1.isValid() && priority2.isValid() )
84 const int i1 = priority1.toInt();
85 const int i2 = priority2.toInt();
87 return priority1.toInt() < priority2.toInt();
89 else if ( priority1.isValid() )
93 else if ( priority2.isValid() )
102 QVariant val1 = data( column, CustomSortRole );
103 if ( !val1.isValid() )
104 val1 = text( column );
105 QVariant val2 = other.data( column, CustomSortRole );
106 if ( !val2.isValid() )
107 val2 = other.text( column );
109 if ( !val1.isNull() && !val2.isNull() )
111 val = val1.toDouble( &ok1 ) < val2.toDouble( &ok2 );
116 else if ( ok1 || ok2 )
141 QgsTreeWidgetItem::setData( column, role, value );
142 if ( role == Qt::EditRole )
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.