diff options
author | Liang Qi <liang.qi@qt.io> | 2018-09-27 11:08:55 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-09-27 11:08:55 +0200 |
commit | d0fcaa7eaaae85ddbf0a78efa59b341380c101a4 (patch) | |
tree | 9b3422ae33ef9dfcda0af228c56c3d2eeed7b0c3 /src/corelib/tools | |
parent | f6ce2d42b3cbe049ebcf1a2349a5cd4dde2c6d24 (diff) | |
parent | 5e64957ee4162ecf4456306a530a68761c2b127f (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
src/corelib/global/qconfig-bootstrapped.h
src/widgets/util/qcompleter.cpp
Change-Id: I4f44f0f074982530f2f2e750ce696230b2754cf3
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 58 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.h | 20 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser.cpp | 20 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser_p.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 12 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.h | 2 |
6 files changed, 60 insertions, 58 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 9aeebe624d..816bd974eb 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -171,7 +171,7 @@ static ParsedDate getDateFromJulianDay(qint64 julianDay) static const char monthDays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) static const char qt_shortMonthNames[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -200,9 +200,9 @@ static int fromShortMonthName(const QStringRef &monthName) } return -1; } -#endif // QT_NO_TEXTDATE +#endif // textdate -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) struct ParsedRfcDateTime { QDate date; QTime time; @@ -241,7 +241,7 @@ static ParsedRfcDateTime rfcDateImpl(const QString &s) return result; } -#endif // QT_NO_DATESTRING +#endif // datestring // Return offset in [+-]HH:mm format static QString toOffsetString(Qt::DateFormat format, int offset) @@ -254,6 +254,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) (qAbs(offset) / 60) % 60); } +#if QT_CONFIG(datestring) // Parse offset in [+-]HH[[:]mm] format static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_NOTHROW { @@ -298,6 +299,7 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_ *valid = true; return sign * ((hour * 60) + minute) * 60; } +#endif // datestring /***************************************************************************** QDate member functions @@ -612,7 +614,7 @@ int QDate::weekNumber(int *yearNumber) const return week; } -#if QT_DEPRECATED_SINCE(5, 11) && !defined(QT_NO_TEXTDATE) +#if QT_DEPRECATED_SINCE(5, 11) && QT_CONFIG(textdate) /*! \since 4.5 \deprecated @@ -774,11 +776,11 @@ QString QDate::longDayName(int weekday, MonthNameType type) } return QString(); } -#endif // QT_NO_TEXTDATE && deprecated +#endif // textdate && deprecated -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) static QString toStringTextDate(QDate date) { const ParsedDate pd = getDateFromJulianDay(date.toJulianDay()); @@ -788,7 +790,7 @@ static QString toStringTextDate(QDate date) + QString::number(pd.day) + sp + QString::number(pd.year); } -#endif // QT_NO_TEXTDATE +#endif // textdate static QString toStringIsoDate(qint64 jd) { @@ -864,7 +866,7 @@ QString QDate::toString(Qt::DateFormat format) const case Qt::RFC2822Date: return QLocale::c().toString(*this, QStringViewLiteral("dd MMM yyyy")); default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: return toStringTextDate(*this); #endif @@ -938,7 +940,7 @@ QString QDate::toString(const QString &format) const } #endif -#endif //QT_NO_DATESTRING +#endif // datestring /*! \fn bool QDate::setYMD(int y, int m, int d) @@ -1200,7 +1202,7 @@ qint64 QDate::daysTo(const QDate &d) const \sa QTime::currentTime(), QDateTime::currentDateTime() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \fn QDate QDate::fromString(const QString &string, Qt::DateFormat format) @@ -1233,7 +1235,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format) case Qt::RFC2822Date: return rfcDateImpl(string).date; default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: { QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); @@ -1254,7 +1256,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format) return QDate(year, month, parts.at(2).toInt()); } -#endif // QT_NO_TEXTDATE +#endif // textdate case Qt::ISODate: { // Semi-strict parsing, must be long enough and have non-numeric separators if (string.size() < 10 || string.at(4).isDigit() || string.at(7).isDigit() @@ -1349,7 +1351,7 @@ QDate QDate::fromString(const QString &string, const QString &format) #endif return date; } -#endif // QT_NO_DATESTRING +#endif // datestring /*! \overload @@ -1566,7 +1568,7 @@ int QTime::msec() const return ds() % 1000; } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \overload @@ -1702,7 +1704,7 @@ QString QTime::toString(const QString &format) const } #endif -#endif //QT_NO_DATESTRING +#endif // datestring /*! Sets the time to hour \a h, minute \a m, seconds \a s and @@ -1887,7 +1889,7 @@ int QTime::msecsTo(const QTime &t) const operating system; not all systems provide 1-millisecond accuracy. */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, bool *isMidnight24) { @@ -2069,7 +2071,7 @@ QTime QTime::fromString(const QString &string, const QString &format) return time; } -#endif // QT_NO_DATESTRING +#endif // datestring /*! @@ -3773,7 +3775,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC) } #endif -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \fn QString QDateTime::toString(Qt::DateFormat format) const @@ -3848,7 +3850,7 @@ QString QDateTime::toString(Qt::DateFormat format) const return buf; } default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: { const QPair<QDate, QTime> p = getDateTime(d); buf = p.first.toString(Qt::TextDate); @@ -3993,7 +3995,7 @@ QString QDateTime::toString(const QString &format) const } #endif -#endif //QT_NO_DATESTRING +#endif // datestring static inline void massageAdjustedDateTime(const QDateTimeData &d, QDate *date, QTime *time) { @@ -4722,7 +4724,7 @@ int QDateTime::utcOffset() const } #endif // QT_DEPRECATED_SINCE -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) /*! \fn QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format) @@ -4827,7 +4829,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) date = date.addDays(1); return QDateTime(date, time, spec, offset); } -#if !defined(QT_NO_TEXTDATE) +#if QT_CONFIG(textdate) case Qt::TextDate: { QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); @@ -4936,7 +4938,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) return QDateTime(date, time, Qt::UTC); } } -#endif //QT_NO_TEXTDATE +#endif // textdate } return QDateTime(); @@ -5071,7 +5073,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format) return QDateTime(); } -#endif // QT_NO_DATESTRING +#endif // datestring /*! \fn QDateTime QDateTime::toLocalTime() const @@ -5330,7 +5332,7 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime) Date / Time Debug Streams *****************************************************************************/ -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) QDebug operator<<(QDebug dbg, const QDate &date) { QDebugStateSaver saver(dbg); @@ -5382,7 +5384,7 @@ QDebug operator<<(QDebug dbg, const QDateTime &date) } return dbg.nospace() << ')'; } -#endif +#endif // debug_stream && datestring /*! \fn uint qHash(const QDateTime &key, uint seed = 0) \relates QHash diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 5a7b75db62..43271b34ed 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -81,7 +81,7 @@ public: int daysInYear() const; int weekNumber(int *yearNum = nullptr) const; -#if QT_DEPRECATED_SINCE(5, 10) && !defined QT_NO_TEXTDATE +#if QT_DEPRECATED_SINCE(5, 10) && QT_CONFIG(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") @@ -90,8 +90,8 @@ public: 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 +#endif // textdate && deprecated +#if QT_CONFIG(datestring) QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; @@ -123,7 +123,7 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d) Q_DECL_CONSTEXPR bool operator>=(const QDate &other) const { return jd >= other.jd; } static QDate currentDate(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QDate fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QDate fromString(const QString &s, const QString &format); #endif @@ -167,7 +167,7 @@ public: int minute() const; int second() const; int msec() const; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; @@ -192,7 +192,7 @@ public: Q_DECL_CONSTEXPR inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; } static QTime currentTime(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QTime fromString(const QString &s, const QString &format); #endif @@ -303,7 +303,7 @@ public: void setMSecsSinceEpoch(qint64 msecs); void setSecsSinceEpoch(qint64 secs); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 QString toString(const QString &format) const; @@ -342,7 +342,7 @@ public: static QDateTime currentDateTime(); static QDateTime currentDateTimeUtc(); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QDateTime fromString(const QString &s, const QString &format); #endif @@ -386,7 +386,7 @@ private: friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); #endif -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); #endif }; @@ -401,7 +401,7 @@ Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); #endif // QT_NO_DATASTREAM -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) Q_CORE_EXPORT QDebug operator<<(QDebug, const QDate &); Q_CORE_EXPORT QDebug operator<<(QDebug, const QTime &); Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index d03518e70d..18c44c3a17 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -77,7 +77,7 @@ QDateTimeParser::~QDateTimeParser() int QDateTimeParser::getDigit(const QDateTime &t, int index) const { if (index < 0 || index >= sectionNodes.size()) { -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) qWarning("QDateTimeParser::getDigit() Internal error (%s %d)", qPrintable(t.toString()), index); #else @@ -103,7 +103,7 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const default: break; } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) qWarning("QDateTimeParser::getDigit() Internal error 2 (%s %d)", qPrintable(t.toString()), index); #else @@ -127,7 +127,7 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const { if (index < 0 || index >= sectionNodes.size()) { -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) qWarning("QDateTimeParser::setDigit() Internal error (%s %d %d)", qPrintable(v.toString()), index, newVal); #else @@ -612,7 +612,7 @@ int QDateTimeParser::sectionSize(int sectionIndex) const int QDateTimeParser::sectionMaxSize(Section s, int count) const { -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) int mcount = 12; #endif @@ -636,14 +636,14 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const case DaySection: return 2; case DayOfWeekSectionShort: case DayOfWeekSectionLong: -#ifdef QT_NO_TEXTDATE +#if !QT_CONFIG(textdate) return 2; #else mcount = 7; Q_FALLTHROUGH(); #endif case MonthSection: -#ifdef QT_NO_TEXTDATE +#if !QT_CONFIG(textdate) return 2; #else if (count <= 2) @@ -725,7 +725,7 @@ QString QDateTimeParser::sectionText(int sectionIndex) const } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDateTimeParser::ParsedSection QDateTimeParser::parseSection(const QDateTime ¤tValue, int sectionIndex, @@ -1727,7 +1727,7 @@ QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionI return PossibleBoth; return (!broken[amindex] ? PossibleAM : PossiblePM); } -#endif // QT_NO_DATESTRING +#endif // datestring /*! \internal @@ -1958,7 +1958,7 @@ QString QDateTimeParser::stateName(State s) const } } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const { QDateTime val(QDate(1900, 1, 1), QDATETIMEEDIT_TIME_MIN); @@ -1983,7 +1983,7 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con } return true; } -#endif // QT_NO_DATESTRING +#endif // datestring QDateTime QDateTimeParser::getMinimum() const { diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index c9e63fe307..f7e6e351fe 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -180,7 +180,7 @@ public: LowerCase }; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) StateNode parse(QString input, int position, const QDateTime &defaultValue, bool fixup) const; bool fromString(const QString &text, QDate *date, QTime *time) const; #endif @@ -202,7 +202,7 @@ public: private: int sectionMaxSize(Section s, int count) const; QString sectionText(const QString &text, int sectionIndex, int index) const; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) StateNode scanString(const QDateTime &defaultValue, bool fixup, QString *input) const; struct ParsedSection { @@ -237,7 +237,7 @@ private: PossibleBoth = 4 }; AmPmFinder findAmPm(QString &str, int index, int *used = 0) const; -#endif // QT_NO_DATESTRING +#endif // datestring bool potentialValue(const QStringRef &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const; diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b285e58779..ddc973cb37 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2074,7 +2074,7 @@ QString QLocale::dateTimeFormat(FormatType format) const \sa timeFormat(), toDate(), toDateTime(), QTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QTime QLocale::toTime(const QString &string, FormatType format) const { return toTime(string, timeFormat(format)); @@ -2092,7 +2092,7 @@ QTime QLocale::toTime(const QString &string, FormatType format) const \sa dateFormat(), toTime(), toDateTime(), QDate::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDate QLocale::toDate(const QString &string, FormatType format) const { return toDate(string, dateFormat(format)); @@ -2111,7 +2111,7 @@ QDate QLocale::toDate(const QString &string, FormatType format) const \sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDateTime QLocale::toDateTime(const QString &string, FormatType format) const { return toDateTime(string, dateTimeFormat(format)); @@ -2129,7 +2129,7 @@ QDateTime QLocale::toDateTime(const QString &string, FormatType format) const \sa timeFormat(), toDate(), toDateTime(), QTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QTime QLocale::toTime(const QString &string, const QString &format) const { QTime time; @@ -2160,7 +2160,7 @@ QTime QLocale::toTime(const QString &string, const QString &format) const \sa dateFormat(), toTime(), toDateTime(), QDate::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDate QLocale::toDate(const QString &string, const QString &format) const { QDate date; @@ -2191,7 +2191,7 @@ QDate QLocale::toDate(const QString &string, const QString &format) const \sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString() */ -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDateTime QLocale::toDateTime(const QString &string, const QString &format) const { #if QT_CONFIG(datetimeparser) diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 8e6c5c503b..f3afb8c406 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -1004,7 +1004,7 @@ public: QString dateFormat(FormatType format = LongFormat) const; QString timeFormat(FormatType format = LongFormat) const; QString dateTimeFormat(FormatType format = LongFormat) const; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDate toDate(const QString &string, FormatType = LongFormat) const; QTime toTime(const QString &string, FormatType = LongFormat) const; QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const; |