Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgsnumericsortlistviewitem.cpp - A QListViewItem that can sort numerically 00003 (as opposed to just lexigraphically) 00004 ------------------- 00005 begin : 06 Nov, 2005 00006 copyright : (C) 2005 by Brendan Morley 00007 email : morb at ozemail dot com dot au 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 ***************************************************************************/ 00018 00019 00020 #include "qgsnumericsortlistviewitem.h" 00021 00022 00023 QgsNumericSortTreeWidgetItem::QgsNumericSortTreeWidgetItem( QTreeWidget * parent ) 00024 : QTreeWidgetItem( parent, UserType ) 00025 { 00026 // NOOP 00027 } 00028 00029 QgsNumericSortTreeWidgetItem::QgsNumericSortTreeWidgetItem( QTreeWidgetItem * parent ) 00030 : QTreeWidgetItem( parent, UserType ) 00031 { 00032 // NOOP 00033 } 00034 00035 QgsNumericSortTreeWidgetItem::~QgsNumericSortTreeWidgetItem() 00036 { 00037 // NOOP 00038 } 00039 00040 bool QgsNumericSortTreeWidgetItem::operator<( const QTreeWidgetItem &other ) const 00041 { 00042 int column = treeWidget() ? treeWidget()->sortColumn() : 0; 00043 if ( column == 0 ) // The ID column 00044 { 00045 return text( column ).toUInt() < other.text( column ).toUInt(); 00046 } 00047 else 00048 return text( column ) < other.text( column ); 00049 }