diff options
Diffstat (limited to 'src/corelib/tools/qdatetime.h')
-rw-r--r-- | src/corelib/tools/qdatetime.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 2518dc7301..adab47fc1f 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -59,7 +59,7 @@ class QTimeZone; class Q_CORE_EXPORT QDate { public: - enum MonthNameType { + enum MonthNameType { // ### Qt 6: remove, along with methods using it DateFormat = 0, StandaloneFormat }; @@ -81,16 +81,23 @@ public: int daysInYear() const; int weekNumber(int *yearNum = Q_NULLPTR) const; -#ifndef QT_NO_TEXTDATE - static QString shortMonthName(int month, MonthNameType type = DateFormat); - static QString shortDayName(int weekday, MonthNameType type = DateFormat); - static QString longMonthName(int month, MonthNameType type = DateFormat); - static QString longDayName(int weekday, MonthNameType type = DateFormat); -#endif // QT_NO_TEXTDATE +#if QT_DEPRECATED_SINCE(5, 11) && !defined QT_NO_TEXTDATE + QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") + static QString shortMonthName(int month, MonthNameType type = DateFormat); + QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") + static QString shortDayName(int weekday, MonthNameType type = DateFormat); + QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") + static QString longMonthName(int month, MonthNameType type = DateFormat); + QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") + static QString longDayName(int weekday, MonthNameType type = DateFormat); +#endif // QT_NO_TEXTDATE && deprecated #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; +#if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; #endif + QString toString(QStringView format) const; +#endif #if QT_DEPRECATED_SINCE(5,0) QT_DEPRECATED inline bool setYMD(int y, int m, int d) { if (uint(y) <= 99) y += 1900; return setDate(y, m, d); } @@ -162,8 +169,11 @@ public: int msec() const; #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; +#if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; #endif + QString toString(QStringView format) const; +#endif bool setHMS(int h, int m, int s, int ms = 0); Q_REQUIRED_RESULT QTime addSecs(int secs) const; @@ -295,8 +305,11 @@ public: #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; +#if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; #endif + QString toString(QStringView format) const; +#endif Q_REQUIRED_RESULT QDateTime addDays(qint64 days) const; Q_REQUIRED_RESULT QDateTime addMonths(int months) const; Q_REQUIRED_RESULT QDateTime addYears(int years) const; |