diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/time/qdatetime.h | 2 | ||||
-rw-r--r-- | src/corelib/time/qdatetimeparser.cpp | 9 | ||||
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index 5a8e1aecd8..62642a5fd2 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -55,7 +55,9 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSDate); QT_BEGIN_NAMESPACE +#if QT_CONFIG(timezone) class QTimeZone; +#endif class QDateTime; class Q_CORE_EXPORT QDate // ### Qt 6: change to be used by value, not const & diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 860f975b4f..5bd2821827 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -788,11 +788,9 @@ QDateTimeParser::parseSection(const QDateTime ¤tValue, int sectionIndex, text->replace(offset, used, sectiontext.constData(), used); break; } case TimeZoneSection: -#if QT_CONFIG(timezone) result = findTimeZone(sectionTextRef, currentValue, absoluteMax(sectionIndex), absoluteMin(sectionIndex)); -#endif break; case MonthSection: case DayOfWeekSectionShort: @@ -1692,7 +1690,12 @@ QDateTimeParser::findTimeZone(QStringRef str, const QDateTime &when, if (index > 0 && maxVal >= offset && offset >= minVal) return ParsedSection(Acceptable, offset, index); -#endif // timezone +#else // timezone + Q_UNUSED(str); + Q_UNUSED(when); + Q_UNUSED(maxVal); + Q_UNUSED(minVal); +#endif return ParsedSection(); } diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 8db5a12a4b..5d64aad040 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1728,9 +1728,12 @@ QDateTime QDateTimeEditPrivate::convertTimeSpec(const QDateTime &datetime) return datetime.toLocalTime(); case Qt::OffsetFromUTC: return datetime.toOffsetFromUtc(value.toDateTime().offsetFromUtc()); -#if QT_CONFIG(timezone) case Qt::TimeZone: +#if QT_CONFIG(timezone) return datetime.toTimeZone(value.toDateTime().timeZone()); +#else + qWarning("QDateTimeEdit: Internal: enable timezone feature to support Qt::TimeZone"); + return datetime; #endif } Q_UNREACHABLE(); |