23#include "moc_qgstreewidgetitem.cpp"
26 : QTreeWidgetItem( parent, type )
30 : QTreeWidgetItem( type )
34 : QTreeWidgetItem( strings, type )
38 : QTreeWidgetItem( view, strings, type )
42 : QTreeWidgetItem( view, after, type )
46 : QTreeWidgetItem( parent, type )
50 : QTreeWidgetItem( parent, strings, type )
54 : QTreeWidgetItem( parent, after, type )
59 setData( column, CustomSortRole, value );
64 return data( column, CustomSortRole );
69 setData( 0, AlwaysOnTopPriorityRole, priority );
74 const QVariant val = data( 0, AlwaysOnTopPriorityRole );
75 return val.isValid() ? val.toInt() : -1;
80 const int column = treeWidget()->sortColumn();
84 const QVariant priority1 = data( 0, AlwaysOnTopPriorityRole );
85 const QVariant priority2 = other.data( 0, AlwaysOnTopPriorityRole );
86 if ( priority1.isValid() && priority2.isValid() )
88 const int i1 = priority1.toInt();
89 const int i2 = priority2.toInt();
91 return priority1.toInt() < priority2.toInt();
93 else if ( priority1.isValid() )
97 else if ( priority2.isValid() )
106 QVariant val1 = data( column, CustomSortRole );
107 if ( !val1.isValid() )
108 val1 = text( column );
109 QVariant val2 = other.data( column, CustomSortRole );
110 if ( !val2.isValid() )
111 val2 = other.text( column );
115 val = val1.toDouble( &ok1 ) < val2.toDouble( &ok2 );
120 else if ( ok1 || ok2 )
145 QgsTreeWidgetItem::setData( column, role, value );
146 if ( role == Qt::EditRole )
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
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.