make column sorting three-state: asc -> dsc -> off/default (= by room state)
authorsheepluva
Wed, 02 May 2012 11:28:38 +0200
changeset 6989 4c35e9cf6057
parent 6988 5d78966a79d2
child 6990 40e5af28d026
make column sorting three-state: asc -> dsc -> off/default (= by room state)
QTfrontend/ui/page/pageroomslist.cpp
--- a/QTfrontend/ui/page/pageroomslist.cpp	Wed May 02 10:57:36 2012 +0200
+++ b/QTfrontend/ui/page/pageroomslist.cpp	Wed May 02 11:28:38 2012 +0200
@@ -504,5 +504,9 @@
 
 void PageRoomsList::onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order)
 {
-    roomsModel->sort(logicalIndex, order);
+    // three state sorting: asc -> dsc -> default (by room state)
+    if ((order == Qt::AscendingOrder) && (logicalIndex == roomsModel->sortColumn()))
+        roomsList->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder);
+    else
+        roomsModel->sort(logicalIndex, order);
 }