[vlc-devel] [PATCH] qt: Replace deprecated qSort with std::sort

Marvin Scholz epirat07 at gmail.com
Fri Jul 26 21:53:36 CEST 2019


---
 modules/gui/qt/components/epg/EPGChannels.cpp | 2 +-
 modules/gui/qt/components/epg/EPGProgram.cpp  | 4 ++--
 modules/gui/qt/components/epg/EPGProgram.hpp  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/components/epg/EPGChannels.cpp b/modules/gui/qt/components/epg/EPGChannels.cpp
index bb1272916a..f0230b2f10 100644
--- a/modules/gui/qt/components/epg/EPGChannels.cpp
+++ b/modules/gui/qt/components/epg/EPGChannels.cpp
@@ -50,7 +50,7 @@ void EPGChannels::addProgram( const EPGProgram *program )
     if ( !programsList.contains( program ) )
     {
         programsList << program;
-        qSort(programsList.begin(), programsList.end(), EPGProgram::lessThan);
+        std::sort(programsList.begin(), programsList.end());
         update();
     }
 }
diff --git a/modules/gui/qt/components/epg/EPGProgram.cpp b/modules/gui/qt/components/epg/EPGProgram.cpp
index aad5dd1dd0..43da84ea6c 100644
--- a/modules/gui/qt/components/epg/EPGProgram.cpp
+++ b/modules/gui/qt/components/epg/EPGProgram.cpp
@@ -39,9 +39,9 @@ EPGProgram::~EPGProgram()
     eventsbytime.clear();
 }
 
-bool EPGProgram::lessThan( const EPGProgram *a, const EPGProgram *b )
+bool EPGProgram::operator<( const EPGProgram &b ) const
 {
-    return a->pos < b->pos;
+    return this->pos < b.pos;
 }
 
 size_t EPGProgram::getPosition() const
diff --git a/modules/gui/qt/components/epg/EPGProgram.hpp b/modules/gui/qt/components/epg/EPGProgram.hpp
index 8265877c90..48fb6d060b 100644
--- a/modules/gui/qt/components/epg/EPGProgram.hpp
+++ b/modules/gui/qt/components/epg/EPGProgram.hpp
@@ -48,7 +48,7 @@ class EPGProgram : public QObject
         void activate();
         const EPGItem * getCurrent() const;
         const QString & getName() const;
-        static bool lessThan( const EPGProgram *, const EPGProgram * );
+        bool operator<( const EPGProgram &b ) const;
 
         QHash<uint32_t, EPGItem *> eventsbyid;
         QMap<QDateTime, const EPGItem *> eventsbytime;
-- 
2.19.1



More information about the vlc-devel mailing list