From: asl Date: Thu, 21 Sep 2017 13:34:35 +0000 (+0300) Subject: refs #1331: sorting of profiles points by column X-Git-Tag: v2.1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=81f3aca1cb8465936e7cf352d48948deebf48622;p=modules%2Fgeom.git refs #1331: sorting of profiles points by column --- diff --git a/src/CurveCreator/CurveCreator_TableView.cxx b/src/CurveCreator/CurveCreator_TableView.cxx index bda45103e..6cd0b35ae 100644 --- a/src/CurveCreator/CurveCreator_TableView.cxx +++ b/src/CurveCreator/CurveCreator_TableView.cxx @@ -94,10 +94,13 @@ void CurveCreator_TableItemDelegate::setModelData( QWidget* theEditor, QItemDelegate::setModelData( theEditor, theModel, theIndex ); } + + + CurveCreator_TableView::CurveCreator_TableView( CurveCreator_ICurve* theCurve, QWidget* theParent, const QStringList& theCoordTitles ) -: QTableWidget( theParent ), myCurve( theCurve ) + : QTableWidget( theParent ), myCurve( theCurve ), myCurrentSortId( -1 ), myCurrentSortOrder( Qt::AscendingOrder ) { setItemDelegate( new CurveCreator_TableItemDelegate( this ) ); setVisible( false ); @@ -199,5 +202,12 @@ int CurveCreator_TableView::getPointId( const int theRowId ) const void CurveCreator_TableView::OnHeaderClick( int theLogicalId ) { - sortByColumn( theLogicalId, Qt::AscendingOrder ); + if( theLogicalId == myCurrentSortId ) + if( myCurrentSortOrder == Qt::AscendingOrder ) + myCurrentSortOrder = Qt::DescendingOrder; + else + myCurrentSortOrder = Qt::AscendingOrder; + + sortByColumn( theLogicalId, myCurrentSortOrder ); + myCurrentSortId = theLogicalId; } diff --git a/src/CurveCreator/CurveCreator_TableView.h b/src/CurveCreator/CurveCreator_TableView.h index bfc0e9b69..67d813c17 100644 --- a/src/CurveCreator/CurveCreator_TableView.h +++ b/src/CurveCreator/CurveCreator_TableView.h @@ -69,6 +69,8 @@ private slots: private: CurveCreator_ICurve* myCurve; + int myCurrentSortId; + Qt::SortOrder myCurrentSortOrder; }; #endif // CURVECREATOR_TABLEVIEW_H