changeset 28567:faf144a49db8

avoid deprecated qSort function * find-files-model.cc, file-editor.cc, resource-manager.cc, variable-editor.cc: Use std::sort instead of qSort.
author John W. Eaton <jwe@octave.org>
date Mon, 13 Jul 2020 15:31:28 -0400
parents 20ee8aa92897
children 22f2438fbce6
files libgui/src/find-files-model.cc libgui/src/m-editor/file-editor.cc libgui/src/resource-manager.cc libgui/src/variable-editor.cc
diffstat 4 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/find-files-model.cc	Mon Jul 13 14:57:22 2020 -0400
+++ b/libgui/src/find-files-model.cc	Mon Jul 13 15:31:28 2020 -0400
@@ -27,6 +27,8 @@
 #  include "config.h"
 #endif
 
+#include <algorithm>
+
 #include <QFileIconProvider>
 #include <QtAlgorithms>
 
@@ -192,8 +194,8 @@
       {
         beginResetModel ();
 
-        qSort (m_files.begin (), m_files.end (),
-               find_file_less_than (m_sortorder));
+        std::sort (m_files.begin (), m_files.end (),
+                   find_file_less_than (m_sortorder));
 
         endResetModel ();
       }
--- a/libgui/src/m-editor/file-editor.cc	Mon Jul 13 14:57:22 2020 -0400
+++ b/libgui/src/m-editor/file-editor.cc	Mon Jul 13 15:31:28 2020 -0400
@@ -29,6 +29,8 @@
 
 #if defined (HAVE_QSCINTILLA)
 
+#include <algorithm>
+
 #include <QApplication>
 #include <QFile>
 #include <QFileDialog>
@@ -336,7 +338,7 @@
         s_data << item;
       }
 
-    qSort (s_data);
+    std::sort (s_data.begin (), s_data.end ());
 
     // finally open the files with the desired encoding in the desired order
     for (int n = 0; n < s_data.count (); ++n)
--- a/libgui/src/resource-manager.cc	Mon Jul 13 14:57:22 2020 -0400
+++ b/libgui/src/resource-manager.cc	Mon Jul 13 15:31:28 2020 -0400
@@ -27,6 +27,7 @@
 #  include "config.h"
 #endif
 
+#include <algorithm>
 #include <array>
 #include <string>
 
@@ -474,7 +475,7 @@
 
     // Clean up and sort list of codecs
     codecs->removeDuplicates ();
-    qSort (*codecs);
+    std::sort (codecs->begin (), codecs->end ());
   }
 
   // initialize a given combo box with available text encodings
--- a/libgui/src/variable-editor.cc	Mon Jul 13 14:57:22 2020 -0400
+++ b/libgui/src/variable-editor.cc	Mon Jul 13 15:31:28 2020 -0400
@@ -27,6 +27,7 @@
 #  include "config.h"
 #endif
 
+#include <algorithm>
 #include <limits>
 
 #include <QApplication>
@@ -821,7 +822,7 @@
 
     QItemSelectionModel *sel = selectionModel ();
     QList<QModelIndex> indices = sel->selectedIndexes ();
-    qSort (indices);
+    std::sort (indices.begin (), indices.end ());
 
     if (indices.isEmpty ())
       return;