diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index d56ea9f43af..c2cff280011 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 4db6950f762..34c14a89b4e 100644 --- a/src/corelib/text/qcollator.cpp +++ b/src/corelib/text/qcollator.cpp @@ -318,7 +318,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 @@ -327,6 +327,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}. */ #endif // QT_STRINGVIEW_LEVEL < 2 diff --git a/src/corelib/text/qcollator.h b/src/corelib/text/qcollator.h index 315ce43e9b5..3a9824448b7 100644 --- a/src/corelib/text/qcollator.h +++ b/src/corelib/text/qcollator.h @@ -68,8 +68,12 @@ public: #if QT_STRINGVIEW_LEVEL < 2 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; }