path: root/src/corelib/tools/qstringlist.cpp
diff options
authorGiuseppe D'Angelo <>2012-11-01 23:07:56 +0100
committerThe Qt Project <>2013-09-09 16:21:10 +0200
commitf30f58edc31fec0b992cb291e5c959563341176a (patch)
tree5bee43d432cb90ac70fc0a7cdb59d85c597ce359 /src/corelib/tools/qstringlist.cpp
parentdaf09978440a3d358e354d6fd98a8eff831ca934 (diff)
Remove qSort usages from QStringList
QtAlgorithms is getting deprecated, see Change-Id: I38d220142d4f5e580503cc10f804e0d16f418cc1 Reviewed-by: Olivier Goffart <>
Diffstat (limited to 'src/corelib/tools/qstringlist.cpp')
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index a5559a181b..870ac23028 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -43,6 +43,8 @@
#include <qset.h>
#include <qregularexpression.h>
+#include <algorithm>
/*! \typedef QStringListIterator
@@ -222,8 +224,8 @@ QT_BEGIN_NAMESPACE
If \a cs is \l Qt::CaseSensitive (the default), the string comparison
is case sensitive; otherwise the comparison is case insensitive.
- Sorting is performed using Qt's qSort() algorithm,
- which operates in \l{linear-logarithmic time}, i.e. O(\e{n} log \e{n}).
+ Sorting is performed using the STL's std::sort() algorithm,
+ which averages \l{linear-logarithmic time}, i.e. O(\e{n} log \e{n}).
If you want to sort your strings in an arbitrary order, consider
using the QMap class. For example, you could use a QMap<QString,
@@ -231,8 +233,6 @@ QT_BEGIN_NAMESPACE
being lower-case versions of the strings, and the values being the
strings), or a QMap<int, QString> to sort the strings by some
integer index.
- \sa qSort()
static inline bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
@@ -243,9 +243,9 @@ static inline bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
void QtPrivate::QStringList_sort(QStringList *that, Qt::CaseSensitivity cs)
if (cs == Qt::CaseSensitive)
- qSort(that->begin(), that->end());
+ std::sort(that->begin(), that->end());
- qSort(that->begin(), that->end(), caseInsensitiveLessThan);
+ std::sort(that->begin(), that->end(), caseInsensitiveLessThan);