diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 1ccb67203e..13a8377f4a 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -1367,10 +1367,6 @@ inline char qToLower(char ch) } -#if QT_DEPRECATED_SINCE(5, 9) -const QString::Null QString::null = { }; -#endif - /*! \macro QT_RESTRICTED_CAST_FROM_ASCII \relates QString @@ -6246,22 +6242,6 @@ QString QString::toUpper_helper(QString &str) return QUnicodeTables::convertCase(str, QUnicodeTables::UpperCase); } -#if QT_DEPRECATED_SINCE(5, 14) -/*! - \obsolete - - Use asprintf(), arg() or QTextStream instead. -*/ -QString &QString::sprintf(const char *cformat, ...) -{ - va_list ap; - va_start(ap, cformat); - *this = vasprintf(cformat, ap); - va_end(ap); - return *this; -} -#endif - // ### Qt 6: Consider whether this function shouldn't be removed See task 202871. /*! \since 5.5 @@ -6306,18 +6286,6 @@ QString QString::asprintf(const char *cformat, ...) return s; } -#if QT_DEPRECATED_SINCE(5, 14) -/*! - \obsolete - - Use vasprintf(), arg() or QTextStream instead. -*/ -QString &QString::vsprintf(const char *cformat, va_list ap) -{ - return *this = vasprintf(cformat, ap); -} -#endif - static void append_utf8(QString &qs, const char *cs, int len) { const int oldSize = qs.size(); @@ -7216,16 +7184,6 @@ static ResultList splitString(const StringSource &source, QStringView sep, return list; } -#if QT_DEPRECATED_SINCE(5, 15) -Qt::SplitBehavior mapSplitBehavior(QString::SplitBehavior sb) -{ -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - return sb & QString::SkipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts; -QT_WARNING_POP -} -#endif - } // namespace /*! @@ -7263,17 +7221,6 @@ QStringList QString::split(const QString &sep, Qt::SplitBehavior behavior, Qt::C return splitString(*this, sep, behavior, cs); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \obsolete -*/ -QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const -{ - return split(sep, mapSplitBehavior(behavior), cs); -} -#endif - /*! Splits the string into substring references wherever \a sep occurs, and returns the list of those strings. @@ -7293,18 +7240,6 @@ QVector QString::splitRef(const QString &sep, Qt::SplitBehavior beha return splitString>(QStringRef(this), sep, behavior, cs); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \obsolete - \since 5.4 -*/ -QVector QString::splitRef(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const -{ - return splitRef(sep, mapSplitBehavior(behavior), cs); -} -#endif - /*! \overload \since 5.14 @@ -7314,17 +7249,6 @@ QStringList QString::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensit return splitString(*this, QStringView(&sep, 1), behavior, cs); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \obsolete -*/ -QStringList QString::split(QChar sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const -{ - return split(sep, mapSplitBehavior(behavior), cs); -} -#endif - /*! \overload \since 5.14 @@ -7335,17 +7259,6 @@ QVector QString::splitRef(QChar sep, Qt::SplitBehavior behavior, return splitString >(QStringRef(this), QStringView(&sep, 1), behavior, cs); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \since 5.4 -*/ -QVector QString::splitRef(QChar sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const -{ - return splitRef(sep, mapSplitBehavior(behavior), cs); -} -#endif - /*! Splits the string into substrings references wherever \a sep occurs, and returns the list of those strings. @@ -7363,18 +7276,6 @@ QVector QStringRef::split(const QString &sep, Qt::SplitBehavior beha return splitString >(*this, sep, behavior, cs); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \since 5.4 - \obsolete -*/ -QVector QStringRef::split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const -{ - return split(sep, mapSplitBehavior(behavior), cs); -} -#endif - /*! \overload \since 5.14 @@ -7384,19 +7285,6 @@ QVector QStringRef::split(QChar sep, Qt::SplitBehavior behavior, Qt: return splitString >(*this, QStringView(&sep, 1), behavior, cs); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \since 5.4 - \obsolete -*/ -QVector QStringRef::split(QChar sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const -{ - return split(sep, mapSplitBehavior(behavior), cs); -} -#endif - - /*! \fn QList QStringView::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const \fn QList QStringView::split(QStringView sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const @@ -7485,18 +7373,6 @@ QStringList QString::split(const QRegularExpression &re, Qt::SplitBehavior behav return splitString(*this, re, behavior); } -# if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \since 5.0 - \obsolete -*/ -QStringList QString::split(const QRegularExpression &re, SplitBehavior behavior) const -{ - return split(re, mapSplitBehavior(behavior)); -} -# endif - /*! \overload \since 5.14 @@ -7534,17 +7410,6 @@ QList QStringView::split(const QRegularExpression &re, Qt::SplitBeh return splitString>(*this, re, behavior); } -# if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \since 5.4 - \obsolete -*/ -QVector QString::splitRef(const QRegularExpression &re, SplitBehavior behavior) const -{ - return splitRef(re, mapSplitBehavior(behavior)); -} -# endif #endif // QT_CONFIG(regularexpression) /*! diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index bb946b655e..77a95c6280 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -247,10 +247,6 @@ private: Q_DECLARE_TYPEINFO(QLatin1String, Q_MOVABLE_TYPE); // Qt 4.x compatibility -#if QT_DEPRECATED_SINCE(5, 14) -QT_DEPRECATED_X("Use QLatin1String") -typedef QLatin1String QLatin1Literal; -#endif // // QLatin1String inline implementations @@ -386,12 +382,6 @@ public: arg(Args &&...args) const { return qToStringViewIgnoringNull(*this).arg(std::forward(args)...); } -#if QT_DEPRECATED_SINCE(5, 14) - QT_DEPRECATED_X("Use vasprintf(), arg() or QTextStream instead") - QString &vsprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(2, 0); - QT_DEPRECATED_X("Use asprintf(), arg() or QTextStream instead") - QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); -#endif static QString vasprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(1, 0); static QString asprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(1, 2); @@ -586,33 +576,6 @@ public: { return replace(re, QString()); } #endif -#if QT_DEPRECATED_SINCE(5, 15) - enum SplitBehavior // ### Qt 6: replace with Qt:: version - { - KeepEmptyParts Q_DECL_ENUMERATOR_DEPRECATED, - SkipEmptyParts Q_DECL_ENUMERATOR_DEPRECATED - }; - - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QStringList split(const QString &sep, SplitBehavior behavior, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const; - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QVector splitRef(const QString &sep, SplitBehavior behavior, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const; - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QStringList split(QChar sep, SplitBehavior behavior, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const; - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QVector splitRef(QChar sep, SplitBehavior behavior, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -#if QT_CONFIG(regularexpression) - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QStringList split(const QRegularExpression &sep, SplitBehavior behavior) const; - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QVector splitRef(const QRegularExpression &sep, SplitBehavior behavior) const; -#endif -#endif // 5.15 deprecations - public: Q_REQUIRED_RESULT QStringList split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, @@ -927,14 +890,7 @@ public: static QString fromNSString(const NSString *string); NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED; #endif - // compatibility -#if QT_DEPRECATED_SINCE(5, 9) - struct Null { }; - QT_DEPRECATED_X("use QString()") - static const Null null; - inline QString(const Null &) {} - inline QString &operator=(const Null &) { *this = QString(); return *this; } -#endif + inline bool isNull() const { return d->isNull(); } @@ -1205,19 +1161,6 @@ inline bool QString::contains(QChar c, Qt::CaseSensitivity cs) const inline bool QString::contains(QStringView s, Qt::CaseSensitivity cs) const noexcept { return indexOf(s, 0, cs) != -1; } -#if QT_DEPRECATED_SINCE(5, 9) -inline bool operator==(QString::Null, QString::Null) { return true; } -QT_DEPRECATED_X("use QString::isNull()") -inline bool operator==(QString::Null, const QString &s) { return s.isNull(); } -QT_DEPRECATED_X("use QString::isNull()") -inline bool operator==(const QString &s, QString::Null) { return s.isNull(); } -inline bool operator!=(QString::Null, QString::Null) { return false; } -QT_DEPRECATED_X("use !QString::isNull()") -inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); } -QT_DEPRECATED_X("use !QString::isNull()") -inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); } -#endif - inline bool operator==(QLatin1String s1, QLatin1String s2) noexcept { return s1.size() == s2.size() && (!s1.size() || !memcmp(s1.latin1(), s2.latin1(), s1.size())); } inline bool operator!=(QLatin1String s1, QLatin1String s2) noexcept @@ -1497,15 +1440,6 @@ public: int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -#if QT_DEPRECATED_SINCE(5, 15) - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QVector split(const QString &sep, QString::SplitBehavior behavior, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const; - Q_REQUIRED_RESULT QT_DEPRECATED_VERSION_X_5_15("Use Qt::SplitBehavior variant instead") - QVector split(QChar sep, QString::SplitBehavior behavior, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -#endif // 5.15 deprecations - Q_REQUIRED_RESULT QVector split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; @@ -1881,14 +1815,6 @@ inline QString operator+(QChar s1, const QStringRef &s2) { QString t; t.reserve(1 + s2.size()); t += s1; t += s2; return t; } #endif // !(QT_USE_FAST_OPERATOR_PLUS || QT_USE_QSTRINGBUILDER) -namespace Qt { -#if QT_DEPRECATED_SINCE(5, 0) -QT_DEPRECATED inline QString escape(const QString &plain) { - return plain.toHtmlEscaped(); -} -#endif -} - namespace QtPrivate { // used by qPrintable() and qUtf8Printable() macros inline const QString &asString(const QString &s) { return s; } diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 69322356a8..0b760f75a8 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -379,13 +379,6 @@ void tst_QVariant::isNull() QString str1; QVariant var1( str1 ); QVERIFY( var1.isNull() ); -#if QT_DEPRECATED_SINCE(5, 9) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QVariant var2( QString::null ); -QT_WARNING_POP - QVERIFY( var2.isNull() ); -#endif QVariant var3( QString( "blah" ) ); QVERIFY( !var3.isNull() ); @@ -405,19 +398,6 @@ QT_WARNING_POP QVariant varLL( (qlonglong)0 ); QVERIFY( !varLL.isNull() ); -#if QT_DEPRECATED_SINCE(5, 9) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QVariant var7(QString::null); -QT_WARNING_POP - QVERIFY(var7.isNull()); -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - var7 = QVariant::fromValue(QString::null); -QT_WARNING_POP - QVERIFY(var7.isNull()); -#endif - QVariant var8(QMetaType::Nullptr, nullptr); QVERIFY(var8.isNull()); var8 = QVariant::fromValue(nullptr); diff --git a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp index 7eea1db7c8..f6a2326af1 100644 --- a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp @@ -598,9 +598,6 @@ void tst_QStringRef::startsWith() QVERIFY(!ref.startsWith("ABCDEF")); QVERIFY(ref.startsWith("")); QVERIFY(ref.startsWith(QString())); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.startsWith(QString::null)); -#endif QVERIFY(ref.startsWith('A')); QVERIFY(ref.startsWith(QLatin1Char('A'))); QVERIFY(ref.startsWith(QChar('A'))); @@ -628,9 +625,6 @@ void tst_QStringRef::startsWith() QVERIFY(!ref.startsWith("abcdef", Qt::CaseInsensitive)); QVERIFY(ref.startsWith("", Qt::CaseInsensitive)); QVERIFY(ref.startsWith(QString(), Qt::CaseInsensitive)); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.startsWith(QString::null, Qt::CaseInsensitive)); -#endif QVERIFY(ref.startsWith('a', Qt::CaseInsensitive)); QVERIFY(ref.startsWith('A', Qt::CaseInsensitive)); QVERIFY(ref.startsWith(QLatin1Char('a'), Qt::CaseInsensitive)); @@ -664,9 +658,6 @@ void tst_QStringRef::startsWith() CREATE_REF(a); QVERIFY(ref.startsWith("")); QVERIFY(ref.startsWith(QString())); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.startsWith(QString::null)); -#endif QVERIFY(!ref.startsWith("ABC")); QVERIFY(ref.startsWith(QLatin1String(""))); @@ -681,9 +672,6 @@ void tst_QStringRef::startsWith() const QStringRef ref; QVERIFY(!ref.startsWith("")); QVERIFY(ref.startsWith(QString())); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.startsWith(QString::null)); -#endif QVERIFY(!ref.startsWith("ABC")); QVERIFY(!ref.startsWith(QLatin1String(""))); @@ -707,9 +695,6 @@ void tst_QStringRef::endsWith() QVERIFY(!ref.endsWith("ABCDEF")); QVERIFY(ref.endsWith("")); QVERIFY(ref.endsWith(QString())); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.endsWith(QString::null)); -#endif QVERIFY(ref.endsWith('B')); QVERIFY(ref.endsWith(QLatin1Char('B'))); QVERIFY(ref.endsWith(QChar('B'))); @@ -737,9 +722,6 @@ void tst_QStringRef::endsWith() QVERIFY(!ref.endsWith("abcdef", Qt::CaseInsensitive)); QVERIFY(ref.endsWith("", Qt::CaseInsensitive)); QVERIFY(ref.endsWith(QString(), Qt::CaseInsensitive)); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.endsWith(QString::null, Qt::CaseInsensitive)); -#endif QVERIFY(ref.endsWith('b', Qt::CaseInsensitive)); QVERIFY(ref.endsWith('B', Qt::CaseInsensitive)); QVERIFY(ref.endsWith(QLatin1Char('b'), Qt::CaseInsensitive)); @@ -774,9 +756,6 @@ void tst_QStringRef::endsWith() CREATE_REF(a); QVERIFY(ref.endsWith("")); QVERIFY(ref.endsWith(QString())); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.endsWith(QString::null)); -#endif QVERIFY(!ref.endsWith("ABC")); QVERIFY(!ref.endsWith(QLatin1Char(0))); QVERIFY(!ref.endsWith(QLatin1Char('x'))); @@ -791,9 +770,6 @@ void tst_QStringRef::endsWith() QStringRef ref; QVERIFY(!ref.endsWith("")); QVERIFY(ref.endsWith(QString())); -#if QT_DEPRECATED_SINCE(5, 9) - QVERIFY(ref.endsWith(QString::null)); -#endif QVERIFY(!ref.endsWith("ABC")); QVERIFY(!ref.endsWith(QLatin1String("")));