19#include "moc_qgstreewidgetitem.cpp"
24 : QTreeWidgetItem( parent, type )
28 : QTreeWidgetItem( type )
32 : QTreeWidgetItem( strings, type )
36 : QTreeWidgetItem( view, strings, type )
40 : QTreeWidgetItem( view, after, type )
44 : QTreeWidgetItem( parent, type )
48 : QTreeWidgetItem( parent, strings, type )
52 : QTreeWidgetItem( parent, after, type )
57 setData( column, CustomSortRole, value );
62 return data( column, CustomSortRole );
67 setData( 0, AlwaysOnTopPriorityRole, priority );
72 const QVariant val = data( 0, AlwaysOnTopPriorityRole );
73 return val.isValid() ? val.toInt() : -1;
78 const int column = treeWidget()->sortColumn();
82 const QVariant priority1 = data( 0, AlwaysOnTopPriorityRole );
83 const QVariant priority2 = other.data( 0, AlwaysOnTopPriorityRole );
84 if ( priority1.isValid() && priority2.isValid() )
86 const int i1 = priority1.toInt();
87 const int i2 = priority2.toInt();
89 return priority1.toInt() < priority2.toInt();
91 else if ( priority1.isValid() )
95 else if ( priority2.isValid() )
104 QVariant val1 = data( column, CustomSortRole );
105 if ( !val1.isValid() )
106 val1 = text( column );
107 QVariant val2 = other.data( column, CustomSortRole );
108 if ( !val2.isValid() )
109 val2 = other.text( column );
113 val = val1.toDouble( &ok1 ) < val2.toDouble( &ok2 );
118 else if ( ok1 || ok2 )
143 QgsTreeWidgetItem::setData( column, role, value );
144 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.