path: root/src/corelib/tools/qcollator.h
diff options
authorEdward Welbourne <>2018-12-07 11:52:59 +0100
committerEdward Welbourne <>2019-03-08 17:07:38 +0000
commita769ab62cbcf957d049c8da74f898527dd27b328 (patch)
treea1f3607ae1472ad39fb1e8662f3781c4e669deeb /src/corelib/tools/qcollator.h
parente89fbd8c3aa50a24e5fc02ab710ccca67fce98e2 (diff)
Extend QCollator to support QStringView
This enables some simplification of the existing implementations. Refined wording of the documentation in the process. [ChangeLog][QtCore][QCollator] Added support for QStringView. Change-Id: Idffaae8d109173d47c7be076828f4b58dc334957 Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/tools/qcollator.h')
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h
index 6fa199cb0f..700de739bb 100644
--- a/src/corelib/tools/qcollator.h
+++ b/src/corelib/tools/qcollator.h
@@ -109,12 +109,18 @@ public:
void setIgnorePunctuation(bool on);
bool ignorePunctuation() const;
int compare(const QString &s1, const QString &s2) const;
int compare(const QStringRef &s1, const QStringRef &s2) const;
int compare(const QChar *s1, int len1, const QChar *s2, int len2) const;
bool operator()(const QString &s1, const QString &s2) const
{ return compare(s1, s2) < 0; }
+ int compare(QStringView s1, QStringView s2) const;
+ bool operator()(QStringView s1, QStringView s2) const
+ { return compare(s1, s2) < 0; }
QCollatorSortKey sortKey(const QString &string) const;