diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index ba844715d8..c4fe85f84f 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -169,6 +169,8 @@ QCalendar::QCalendar(QStringView name) QCalendar::QCalendar(QLatin1StringView name) : QCalendar(QAnyStringView{name}) {} +#include "qcollator.h" // inline function compare(ptr, n, ptr, n) (for MSVC) + #if QT_CONFIG(future) #include "qfutureinterface.h" diff --git a/src/corelib/text/qcollator.cpp b/src/corelib/text/qcollator.cpp index f21df33af4..990c68c062 100644 --- a/src/corelib/text/qcollator.cpp +++ b/src/corelib/text/qcollator.cpp @@ -320,7 +320,7 @@ bool QCollator::ignorePunctuation() const */ /*! - \fn int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const + \fn int QCollator::compare(const QChar *s1, qsizetype len1, const QChar *s2, qsizetype len2) const \overload \since 5.2 @@ -329,6 +329,9 @@ bool QCollator::ignorePunctuation() const Returns an integer less than, equal to, or greater than zero depending on whether \a s1 sorts before, with or after \a s2. + + \note In Qt versions prior to 6.4, the length arguments were of type + \c{int}, not \c{qsizetype}. */ /*! diff --git a/src/corelib/text/qcollator.h b/src/corelib/text/qcollator.h index 76a453c6ae..6f4882989b 100644 --- a/src/corelib/text/qcollator.h +++ b/src/corelib/text/qcollator.h @@ -67,8 +67,12 @@ public: int compare(const QString &s1, const QString &s2) const { return compare(QStringView(s1), QStringView(s2)); } +#if QT_CORE_REMOVED_SINCE(6, 4) && QT_POINTER_SIZE != 4 int compare(const QChar *s1, int len1, const QChar *s2, int len2) const { return compare(QStringView(s1, len1), QStringView(s2, len2)); } +#endif + int compare(const QChar *s1, qsizetype len1, const QChar *s2, qsizetype len2) const + { return compare(QStringView(s1, len1), QStringView(s2, len2)); } bool operator()(const QString &s1, const QString &s2) const { return compare(s1, s2) < 0; }