changeset 27675:fb2724126950

use templated QVariant value extractor instead of static_cast * workspace-view.cc: Use "value<Qt::SortOrder> ()" instead of casting result of toUInt() call to Qt::SortOrder.
author John W. Eaton <jwe@octave.org>
date Tue, 12 Nov 2019 13:35:44 -0500
parents 5d05be5c003d
children ea7d36e9f197
files libgui/src/workspace-view.cc
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/workspace-view.cc	Tue Nov 12 13:32:59 2019 -0500
+++ b/libgui/src/workspace-view.cc	Tue Nov 12 13:35:44 2019 -0500
@@ -128,9 +128,9 @@
 #else
         m_view->horizontalHeader ()->setMovable (true);
 #endif
-        m_view->horizontalHeader ()->setSortIndicator (
-            settings->value (ws_sort_column).toInt (),
-            static_cast<Qt::SortOrder> (settings->value (ws_sort_order).toUInt ()));
+        m_view->horizontalHeader ()->setSortIndicator
+          (settings->value (ws_sort_column).toInt (),
+           settings->value (ws_sort_order).value<Qt::SortOrder> ());
         m_view->horizontalHeader ()->setSortIndicatorShown (true);
 
         m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
@@ -180,9 +180,8 @@
     // set the sorting after a model was set, it would be ignored otherwise
     resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
     gui_settings *settings = rmgr.get_settings ();
-    m_view->sortByColumn (
-      settings->value (ws_sort_column).toInt (),
-      static_cast<Qt::SortOrder> (settings->value (ws_sort_order).toUInt ()));
+    m_view->sortByColumn (settings->value (ws_sort_column).toInt (),
+                          settings->value (ws_sort_order).value<Qt::SortOrder> ());
 
     m_model = model;
   }