diff options
65 files changed, 411 insertions, 310 deletions
diff --git a/src/imports/sharedimage/qsharedimageloader_p.h b/src/imports/sharedimage/qsharedimageloader_p.h index 38e2bd4d54..4b0e989c29 100644 --- a/src/imports/sharedimage/qsharedimageloader_p.h +++ b/src/imports/sharedimage/qsharedimageloader_p.h @@ -58,10 +58,10 @@ class QSharedImageLoader : public QObject public: typedef QVector<QVariant> ImageParameters; - QSharedImageLoader(QObject *parent = Q_NULLPTR); + QSharedImageLoader(QObject *parent = nullptr); ~QSharedImageLoader(); - QImage load(const QString &path, ImageParameters *params = Q_NULLPTR); + QImage load(const QString &path, ImageParameters *params = nullptr); protected: virtual QImage loadFile(const QString &path, ImageParameters *params); diff --git a/src/imports/sharedimage/sharedimageprovider.cpp b/src/imports/sharedimage/sharedimageprovider.cpp index f33057936d..aad6ea3b78 100644 --- a/src/imports/sharedimage/sharedimageprovider.cpp +++ b/src/imports/sharedimage/sharedimageprovider.cpp @@ -60,7 +60,7 @@ public: NumImageParameters }; - QuickSharedImageLoader(QObject *parent = Q_NULLPTR) + QuickSharedImageLoader(QObject *parent = nullptr) : QSharedImageLoader(parent) { } diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp index 0f88ec641b..aaf32f6d19 100644 --- a/src/imports/statemachine/signaltransition.cpp +++ b/src/imports/statemachine/signaltransition.cpp @@ -54,7 +54,7 @@ #include <private/qqmlboundsignal_p.h> SignalTransition::SignalTransition(QState *parent) - : QSignalTransition(this, SIGNAL(invokeYourself()), parent), m_complete(false), m_signalExpression(Q_NULLPTR) + : QSignalTransition(this, SIGNAL(invokeYourself()), parent), m_complete(false), m_signalExpression(nullptr) { connect(this, SIGNAL(signalChanged()), SIGNAL(qmlSignalChanged())); } diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h index 3b3a7dae79..d7a3b7b618 100644 --- a/src/imports/statemachine/signaltransition.h +++ b/src/imports/statemachine/signaltransition.h @@ -59,7 +59,7 @@ class SignalTransition : public QSignalTransition, public QQmlParserStatus Q_PROPERTY(QQmlScriptString guard READ guard WRITE setGuard NOTIFY guardChanged) public: - explicit SignalTransition(QState *parent = Q_NULLPTR); + explicit SignalTransition(QState *parent = nullptr); QQmlScriptString guard() const; void setGuard(const QQmlScriptString &guard); diff --git a/src/imports/statemachine/timeouttransition.h b/src/imports/statemachine/timeouttransition.h index 0e5f5377e3..2fc850fc70 100644 --- a/src/imports/statemachine/timeouttransition.h +++ b/src/imports/statemachine/timeouttransition.h @@ -53,7 +53,7 @@ class TimeoutTransition : public QSignalTransition, public QQmlParserStatus Q_INTERFACES(QQmlParserStatus) public: - TimeoutTransition(QState *parent = Q_NULLPTR); + TimeoutTransition(QState *parent = nullptr); ~TimeoutTransition(); int timeout() const; diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 2467239be2..0afd71767e 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += qml -!contains(QT_CONFIG, no-qml-debug):SUBDIRS += qmltooling +qtConfig(qml-debug):SUBDIRS += qmltooling qtHaveModule(quick):SUBDIRS += scenegraph diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 58d3edf2c4..e0b013eb95 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -60,7 +60,7 @@ QT_REQUIRE_CONFIG(qml_interpreter); QT_BEGIN_NAMESPACE -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) #define MOTH_DEBUG_INSTR(F) #else #define MOTH_DEBUG_INSTR(F) \ diff --git a/src/qml/configure.json b/src/qml/configure.json index 7c0a33bc71..a589e9f950 100644 --- a/src/qml/configure.json +++ b/src/qml/configure.json @@ -8,7 +8,8 @@ "commandline": { "options": { "qml-interpreter": "boolean", - "qml-network": "boolean" + "qml-network": "boolean", + "qml-debug": "boolean" } }, @@ -25,6 +26,12 @@ "section": "QML", "output": [ "publicFeature" ] }, + "qml-debug": { + "label": "QML debugging and profiling support", + "purpose": "Provides infrastructure and plugins for debugging and profiling.", + "section": "QML", + "output": [ "publicFeature" ] + }, "qml-profiler": { "label": "Command line QML Profiler", "purpose": "Supports retrieving QML tracing data from an application.", @@ -33,6 +40,7 @@ "features.commandlineparser", "features.localserver", "features.process", + "features.qml-debug", "features.qml-network", "features.xmlstreamwriter" ], @@ -45,7 +53,8 @@ "section": "Qt QML", "entries": [ "qml-interpreter", - "qml-network" + "qml-network", + "qml-debug" ] } ] diff --git a/src/qml/debugger/debugger.pri b/src/qml/debugger/debugger.pri index b8d2347b17..202a46e550 100644 --- a/src/qml/debugger/debugger.pri +++ b/src/qml/debugger/debugger.pri @@ -1,13 +1,13 @@ -contains(QT_CONFIG, no-qml-debug) { - DEFINES += QT_NO_QML_DEBUGGER - MODULE_DEFINES += QT_NO_QML_DEBUGGER -} else { +qtConfig(qml-debug) { HEADERS += \ + $$PWD/qqmlabstractprofileradapter_p.h \ $$PWD/qqmlconfigurabledebugservice_p.h \ $$PWD/qqmldebugpluginmanager_p.h \ + $$PWD/qqmldebugservice_p.h \ $$PWD/qqmldebugservicefactory_p.h \ $$PWD/qqmldebugserver_p.h \ - $$PWD/qqmldebugserverconnection_p.h + $$PWD/qqmldebugserverconnection_p.h \ + $$PWD/qqmlprofilerdefinitions_p.h SOURCES += \ $$PWD/qqmldebug.cpp \ @@ -21,13 +21,10 @@ contains(QT_CONFIG, no-qml-debug) { HEADERS += \ $$PWD/qqmldebugconnector_p.h \ - $$PWD/qqmldebugservice_p.h \ $$PWD/qqmldebugserviceinterfaces_p.h \ $$PWD/qqmldebugstatesdelegate_p.h \ $$PWD/qqmldebug.h \ $$PWD/qqmlmemoryprofiler_p.h \ - $$PWD/qqmlprofilerdefinitions_p.h \ - $$PWD/qqmlabstractprofileradapter_p.h \ $$PWD/qqmlprofiler_p.h INCLUDEPATH += $$PWD diff --git a/src/qml/debugger/qqmlabstractprofileradapter_p.h b/src/qml/debugger/qqmlabstractprofileradapter_p.h index 6a05a80f37..5d1b339324 100644 --- a/src/qml/debugger/qqmlabstractprofileradapter_p.h +++ b/src/qml/debugger/qqmlabstractprofileradapter_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_QML_DEBUGGER +QT_REQUIRE_CONFIG(qml_debug); class QQmlProfilerService; class Q_QML_PRIVATE_EXPORT QQmlAbstractProfilerAdapter : public QObject, public QQmlProfilerDefinitions { @@ -116,8 +116,6 @@ public: #define QQmlAbstractProfilerAdapterFactory_iid "org.qt-project.Qt.QQmlAbstractProfilerAdapterFactory" -#endif // QT_NO_QML_DEBUGGER - QT_END_NAMESPACE #endif // QQMLABSTRACTPROFILERADAPTER_P_H diff --git a/src/qml/debugger/qqmldebug.cpp b/src/qml/debugger/qqmldebug.cpp index 681dc06215..6246fb4207 100644 --- a/src/qml/debugger/qqmldebug.cpp +++ b/src/qml/debugger/qqmldebug.cpp @@ -44,6 +44,8 @@ #include <private/qqmlengine_p.h> #include <private/qv4compileddata_p.h> +QT_REQUIRE_CONFIG(qml_debug); + QT_BEGIN_NAMESPACE QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning) diff --git a/src/qml/debugger/qqmldebug.h b/src/qml/debugger/qqmldebug.h index 6a0cfdc709..d0ceb28cdc 100644 --- a/src/qml/debugger/qqmldebug.h +++ b/src/qml/debugger/qqmldebug.h @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) struct Q_QML_EXPORT QQmlDebuggingEnabler { diff --git a/src/qml/debugger/qqmldebugconnector_p.h b/src/qml/debugger/qqmldebugconnector_p.h index 0d3e2e2e47..a2a6f5047d 100644 --- a/src/qml/debugger/qqmldebugconnector_p.h +++ b/src/qml/debugger/qqmldebugconnector_p.h @@ -44,7 +44,9 @@ #include <QtQml/qjsengine.h> #include <QtCore/QVariantList> +#if QT_CONFIG(qml_debug) #include <private/qqmldebugservice_p.h> +#endif // // W A R N I N G @@ -59,7 +61,7 @@ QT_BEGIN_NAMESPACE -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) class Q_QML_PRIVATE_EXPORT QQmlDebugConnector { diff --git a/src/qml/debugger/qqmldebugpluginmanager_p.h b/src/qml/debugger/qqmldebugpluginmanager_p.h index 8f52b65b17..2575cbb96a 100644 --- a/src/qml/debugger/qqmldebugpluginmanager_p.h +++ b/src/qml/debugger/qqmldebugpluginmanager_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#if defined(QT_NO_QML_DEBUGGER) +#if !QT_CONFIG(qml_debug) #define Q_QML_DEBUG_PLUGIN_LOADER(interfaceName)\ interfaceName *load##interfaceName(const QString &key)\ @@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE } #define Q_QML_IMPORT_DEBUG_PLUGIN(className) -#else // QT_NO_QML_DEBUGGER +#else // QT_CONFIG(qml_debug) #define Q_QML_DEBUG_PLUGIN_LOADER(interfaceName)\ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, interfaceName##Loader,\ @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE return interfaceName##Loader()->metaData();\ } -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) QT_END_NAMESPACE #endif // QQMLDEBUGPLUGINMANAGER_P_H diff --git a/src/qml/debugger/qqmldebugservice_p.h b/src/qml/debugger/qqmldebugservice_p.h index 42a57a39f2..34bbd631ec 100644 --- a/src/qml/debugger/qqmldebugservice_p.h +++ b/src/qml/debugger/qqmldebugservice_p.h @@ -56,9 +56,9 @@ // We mean it. // -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(qml_debug); -#ifndef QT_NO_QML_DEBUGGER +QT_BEGIN_NAMESPACE class QJSEngine; @@ -103,8 +103,6 @@ signals: void messagesToClient(const QString &name, const QList<QByteArray> &messages); }; -#endif - QT_END_NAMESPACE #endif // QQMLDEBUGSERVICE_H diff --git a/src/qml/debugger/qqmldebugserviceinterfaces_p.h b/src/qml/debugger/qqmldebugserviceinterfaces_p.h index 12965ff383..01693aee24 100644 --- a/src/qml/debugger/qqmldebugserviceinterfaces_p.h +++ b/src/qml/debugger/qqmldebugserviceinterfaces_p.h @@ -53,9 +53,10 @@ #include <QtCore/qstring.h> #include <private/qtqmlglobal_p.h> +#if QT_CONFIG(qml_debug) #include <private/qqmldebugservice_p.h> +#endif #include <private/qqmldebugstatesdelegate_p.h> -#include <private/qqmlabstractprofileradapter_p.h> #include <private/qqmlboundsignal_p.h> #include <limits> @@ -65,7 +66,7 @@ QT_BEGIN_NAMESPACE class QWindow; class QQuickWindow; -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) class QV4DebugService { @@ -120,6 +121,7 @@ protected: QQmlDebugService(s_key, version, parent) {} }; +class QQmlAbstractProfilerAdapter; class Q_QML_PRIVATE_EXPORT QQmlProfilerService : public QQmlDebugService { Q_OBJECT diff --git a/src/qml/debugger/qqmldebugstatesdelegate_p.h b/src/qml/debugger/qqmldebugstatesdelegate_p.h index 95f727fb2d..b2e14873dc 100644 --- a/src/qml/debugger/qqmldebugstatesdelegate_p.h +++ b/src/qml/debugger/qqmldebugstatesdelegate_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) class QQmlDebugStatesDelegate {}; diff --git a/src/qml/debugger/qqmlmemoryprofiler_p.h b/src/qml/debugger/qqmlmemoryprofiler_p.h index fb71c999c3..12a31a851f 100644 --- a/src/qml/debugger/qqmlmemoryprofiler_p.h +++ b/src/qml/debugger/qqmlmemoryprofiler_p.h @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) #define QML_MEMORY_SCOPE_URL(url) #define QML_MEMORY_SCOPE_STRING(s) diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h index 9b51b5ab46..f17b1a7528 100644 --- a/src/qml/debugger/qqmlprofiler_p.h +++ b/src/qml/debugger/qqmlprofiler_p.h @@ -55,15 +55,17 @@ #include <private/qqmlboundsignal_p.h> #include <private/qfinitestack_p.h> #include <private/qqmlbinding_p.h> +#if QT_CONFIG(qml_debug) #include "qqmlprofilerdefinitions_p.h" #include "qqmlabstractprofileradapter_p.h" +#endif #include <QUrl> #include <QString> QT_BEGIN_NAMESPACE -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) #define Q_QML_PROFILE_IF_ENABLED(feature, profiler, Code) #define Q_QML_PROFILE(feature, profiler, Method) @@ -501,6 +503,6 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QVector<QQmlProfilerData>) Q_DECLARE_METATYPE(QQmlProfiler::LocationHash) -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) #endif // QQMLPROFILER_P_H diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h index c6ae4593a9..91d0376837 100644 --- a/src/qml/debugger/qqmlprofilerdefinitions_p.h +++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h @@ -43,6 +43,8 @@ #include <private/qtqmlglobal_p.h> #include <private/qv4profiling_p.h> +QT_REQUIRE_CONFIG(qml_debug); + // // W A R N I N G // ------------- @@ -56,8 +58,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_QML_DEBUGGER - struct QQmlProfilerDefinitions { enum Message { Event, @@ -163,8 +163,6 @@ struct QQmlProfilerDefinitions { }; }; -#endif // QT_NO_QML_DEBUGGER - QT_END_NAMESPACE #endif diff --git a/src/qml/jsapi/qjsengine.h b/src/qml/jsapi/qjsengine.h index f92a26445f..913757107f 100644 --- a/src/qml/jsapi/qjsengine.h +++ b/src/qml/jsapi/qjsengine.h @@ -47,6 +47,8 @@ #include <QtCore/qobject.h> #include <QtQml/qjsvalue.h> +#include <QtQml/qqmldebug.h> + QT_BEGIN_NAMESPACE diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri index a270cb1aa3..519c87d0c4 100644 --- a/src/qml/jsruntime/jsruntime.pri +++ b/src/qml/jsruntime/jsruntime.pri @@ -43,7 +43,7 @@ SOURCES += \ $$PWD/qv4typedarray.cpp \ $$PWD/qv4dataview.cpp -!contains(QT_CONFIG, no-qml-debug): SOURCES += $$PWD/qv4profiling.cpp +qtConfig(qml-debug): SOURCES += $$PWD/qv4profiling.cpp HEADERS += \ $$PWD/qv4global_p.h \ diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 20099b8ec5..b8392d27e9 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -55,16 +55,29 @@ #include <wtf/MathExtras.h> -#ifdef Q_OS_WIN -# include <windows.h> +#ifdef Q_OS_LINUX +/* + See QTBUG-56899. Although we don't (yet) have a proper way to reset the + system zone, the code below, that uses QTimeZone::systemTimeZone(), works + adequately on Linux, when the TZ environment variable is changed. + */ +#define USE_QTZ_SYSTEM_ZONE +#endif + +#ifdef USE_QTZ_SYSTEM_ZONE +#include <QtCore/QTimeZone> #else -# ifndef Q_OS_VXWORKS -# include <sys/time.h> +# ifdef Q_OS_WIN +# include <windows.h> # else -# include "qplatformdefs.h" +# ifndef Q_OS_VXWORKS +# include <sys/time.h> +# else +# include "qplatformdefs.h" +# endif +# include <unistd.h> // for _POSIX_THREAD_SAFE_FUNCTIONS # endif -# include <unistd.h> // for _POSIX_THREAD_SAFE_FUNCTIONS -#endif +#endif // USE_QTZ_SYSTEM_ZONE using namespace QV4; @@ -76,6 +89,7 @@ static const double msPerMinute = 60000.0; static const double msPerHour = 3600000.0; static const double msPerDay = 86400000.0; +// The current *standard* time offset, regardless of DST: static double LocalTZA = 0.0; // initialized at startup static inline double TimeWithinDay(double t) @@ -286,6 +300,31 @@ static inline double MakeDate(double day, double time) return day * msPerDay + time; } +#ifdef USE_QTZ_SYSTEM_ZONE +/* + ECMAScript specifies use of a fixed (current, standard) time-zone offset, + LocalTZA; and LocalTZA + DaylightSavingTA(t) is taken to be (see LocalTime and + UTC, following) local time's offset from UTC at time t. For simple zones, + DaylightSavingTA(t) is thus the DST offset applicable at date/time t; however, + if a zone has changed its standard offset, the only way to make LocalTime and + UTC (if implemented in accord with the spec) perform correct transformations + is to have DaylightSavingTA(t) correct for the zone's standard offset change + as well as its actual DST offset. + + This means we have to treat any historical changes in the zone's standard + offset as DST perturbations, regardless of historical reality. (This shall + mean a whole day of DST offset for some zones, that have crossed the + international date line. This shall confuse client code.) The bug report + against the ECMAScript spec is https://github.com/tc39/ecma262/issues/725 +*/ + +static inline double DaylightSavingTA(double t) // t is a UTC time +{ + return QTimeZone::systemTimeZone().offsetFromUtc( + QDateTime::fromMSecsSinceEpoch(qint64(t), Qt::UTC)) * 1e3 - LocalTZA; +} +#else +// This implementation fails to take account of past changes in standard offset. static inline double DaylightSavingTA(double t) { struct tm tmtm; @@ -307,34 +346,26 @@ static inline double DaylightSavingTA(double t) return 0; return (tmtm.tm_isdst > 0) ? msPerHour : 0; } +#endif // USE_QTZ_SYSTEM_ZONE static inline double LocalTime(double t) { + // Flawed, yet verbatim from the spec: return t + LocalTZA + DaylightSavingTA(t); } +// The spec does note [*] that UTC and LocalTime are not quite mutually inverse. +// [*] http://www.ecma-international.org/ecma-262/7.0/index.html#sec-utc-t + static inline double UTC(double t) { + // Flawed, yet verbatim from the spec: return t - LocalTZA - DaylightSavingTA(t - LocalTZA); } static inline double currentTime() { -#ifndef Q_OS_WIN - struct timeval tv; - - gettimeofday(&tv, 0); - return ::floor(tv.tv_sec * msPerSecond + (tv.tv_usec / 1000.0)); -#else - SYSTEMTIME st; - GetSystemTime(&st); - FILETIME ft; - SystemTimeToFileTime(&st, &ft); - LARGE_INTEGER li; - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - return double(li.QuadPart - Q_INT64_C(116444736000000000)) / 10000.0; -#endif + return QDateTime::currentDateTimeUtc().toMSecsSinceEpoch(); } static inline double TimeClip(double t) @@ -348,13 +379,20 @@ static inline double TimeClip(double t) static inline double ParseString(const QString &s) { - // first try the format defined in 15.9.1.15, only if that fails fall back to - // QDateTime for parsing + /* + First, try the format defined in ECMA 262's "Date Time String Format"; + only if that fails, fall back to QDateTime for parsing + + The defined string format is YYYY-MM-DDTHH:mm:ss.sssZ; the time (T and all + after it) may be omitted; in each part, the second and later components + are optional; and there's an extended syntax for negative and large + positive years: +/-YYYYYY; the leading sign, even when +, isn't optional. + If month or day is omitted, it is 01; if minute or second is omitted, it's + 00; if milliseconds are omitted, they're 000. - // the define string format is YYYY-MM-DDTHH:mm:ss.sssZ - // It can be date or time only, and the second and later components - // of both fields are optional - // and extended syntax for negative and large positive years exists: +/-YYYYYY + When the time zone offset is absent, date-only forms are interpreted as + indicating a UTC time and date-time forms are interpreted in local time. + */ enum Format { Year, @@ -387,6 +425,8 @@ static inline double ParseString(const QString &s) int msec = 0; int offsetSign = 1; int offset = 0; + bool seenT = false; + bool seenZ = false; // Have seen zone, i.e. +HH:mm or literal Z. bool error = false; if (*ch == '+' || *ch == '-') { @@ -395,7 +435,7 @@ static inline double ParseString(const QString &s) yearSign = -1; ++ch; } - while (ch <= end) { + for (; ch <= end && !error && format != Done; ++ch) { if (*ch >= '0' && *ch <= '9') { current *= 10; current += ch->unicode() - '0'; @@ -423,7 +463,7 @@ static inline double ParseString(const QString &s) break; case Minute: minute = current; - error = (currentSize != 2) || minute > 60; + error = (currentSize != 2) || minute >= 60; break; case Second: second = current; @@ -434,8 +474,10 @@ static inline double ParseString(const QString &s) error = (currentSize != 3); break; case TimezoneHour: - offset = current*60; - error = (currentSize != 2) || offset > 23*60; + Q_ASSERT(offset == 0 && !seenZ); + offset = current * 60; + error = (currentSize != 2) || current > 23; + seenZ = true; break; case TimezoneMinute: offset += current; @@ -446,6 +488,7 @@ static inline double ParseString(const QString &s) if (format >= Hour) error = true; format = Hour; + seenT = true; } else if (*ch == '-') { if (format < Day) ++format; @@ -454,6 +497,7 @@ static inline double ParseString(const QString &s) else if (format >= TimezoneHour) error = true; else { + Q_ASSERT(offset == 0 && !seenZ); offsetSign = -1; format = TimezoneHour; } @@ -466,23 +510,31 @@ static inline double ParseString(const QString &s) error = true; ++format; } else if (*ch == '+') { - if (format < Minute || format >= TimezoneHour) + if (seenZ || format < Minute || format >= TimezoneHour) error = true; format = TimezoneHour; - } else if (*ch == 'Z' || ch->unicode() == 0) { + } else if (*ch == 'Z') { + if (seenZ || format < Minute || format >= TimezoneHour) + error = true; + else + Q_ASSERT(offset == 0); + format = Done; + seenZ = true; + } else if (ch->unicode() == 0) { format = Done; } current = 0; currentSize = 0; } - if (error || format == Done) - break; - ++ch; } if (!error) { double t = MakeDate(MakeDay(year * yearSign, month, day), MakeTime(hour, minute, second, msec)); - t -= offset * offsetSign * 60 * 1000; + if (seenZ) + t -= offset * offsetSign * 60 * 1000; + else if (seenT) // No zone specified, treat date-time as local time + t = UTC(t); + // else: treat plain date as already in UTC return t; } @@ -492,56 +544,61 @@ static inline double ParseString(const QString &s) if (!dt.isValid()) dt = QDateTime::fromString(s, Qt::RFC2822Date); if (!dt.isValid()) { - QStringList formats; - formats << QStringLiteral("M/d/yyyy") - << QStringLiteral("M/d/yyyy hh:mm") - << QStringLiteral("M/d/yyyy hh:mm A") - - << QStringLiteral("M/d/yyyy, hh:mm") - << QStringLiteral("M/d/yyyy, hh:mm A") - - << QStringLiteral("MMM d yyyy") - << QStringLiteral("MMM d yyyy hh:mm") - << QStringLiteral("MMM d yyyy hh:mm:ss") - << QStringLiteral("MMM d yyyy, hh:mm") - << QStringLiteral("MMM d yyyy, hh:mm:ss") - - << QStringLiteral("MMMM d yyyy") - << QStringLiteral("MMMM d yyyy hh:mm") - << QStringLiteral("MMMM d yyyy hh:mm:ss") - << QStringLiteral("MMMM d yyyy, hh:mm") - << QStringLiteral("MMMM d yyyy, hh:mm:ss") - - << QStringLiteral("MMM d, yyyy") - << QStringLiteral("MMM d, yyyy hh:mm") - << QStringLiteral("MMM d, yyyy hh:mm:ss") - - << QStringLiteral("MMMM d, yyyy") - << QStringLiteral("MMMM d, yyyy hh:mm") - << QStringLiteral("MMMM d, yyyy hh:mm:ss") - - << QStringLiteral("d MMM yyyy") - << QStringLiteral("d MMM yyyy hh:mm") - << QStringLiteral("d MMM yyyy hh:mm:ss") - << QStringLiteral("d MMM yyyy, hh:mm") - << QStringLiteral("d MMM yyyy, hh:mm:ss") - - << QStringLiteral("d MMMM yyyy") - << QStringLiteral("d MMMM yyyy hh:mm") - << QStringLiteral("d MMMM yyyy hh:mm:ss") - << QStringLiteral("d MMMM yyyy, hh:mm") - << QStringLiteral("d MMMM yyyy, hh:mm:ss") - - << QStringLiteral("d MMM, yyyy") - << QStringLiteral("d MMM, yyyy hh:mm") - << QStringLiteral("d MMM, yyyy hh:mm:ss") - - << QStringLiteral("d MMMM, yyyy") - << QStringLiteral("d MMMM, yyyy hh:mm") - << QStringLiteral("d MMMM, yyyy hh:mm:ss"); - - for (int i = 0; i < formats.size(); ++i) { - dt = QDateTime::fromString(s, formats.at(i)); + const QString formats[] = { + QStringLiteral("M/d/yyyy"), + QStringLiteral("M/d/yyyy hh:mm"), + QStringLiteral("M/d/yyyy hh:mm A"), + + QStringLiteral("M/d/yyyy, hh:mm"), + QStringLiteral("M/d/yyyy, hh:mm A"), + + QStringLiteral("MMM d yyyy"), + QStringLiteral("MMM d yyyy hh:mm"), + QStringLiteral("MMM d yyyy hh:mm:ss"), + QStringLiteral("MMM d yyyy, hh:mm"), + QStringLiteral("MMM d yyyy, hh:mm:ss"), + + QStringLiteral("MMMM d yyyy"), + QStringLiteral("MMMM d yyyy hh:mm"), + QStringLiteral("MMMM d yyyy hh:mm:ss"), + QStringLiteral("MMMM d yyyy, hh:mm"), + QStringLiteral("MMMM d yyyy, hh:mm:ss"), + + QStringLiteral("MMM d, yyyy"), + QStringLiteral("MMM d, yyyy hh:mm"), + QStringLiteral("MMM d, yyyy hh:mm:ss"), + + QStringLiteral("MMMM d, yyyy"), + QStringLiteral("MMMM d, yyyy hh:mm"), + QStringLiteral("MMMM d, yyyy hh:mm:ss"), + + QStringLiteral("d MMM yyyy"), + QStringLiteral("d MMM yyyy hh:mm"), + QStringLiteral("d MMM yyyy hh:mm:ss"), + QStringLiteral("d MMM yyyy, hh:mm"), + QStringLiteral("d MMM yyyy, hh:mm:ss"), + + QStringLiteral("d MMMM yyyy"), + QStringLiteral("d MMMM yyyy hh:mm"), + QStringLiteral("d MMMM yyyy hh:mm:ss"), + QStringLiteral("d MMMM yyyy, hh:mm"), + QStringLiteral("d MMMM yyyy, hh:mm:ss"), + + QStringLiteral("d MMM, yyyy"), + QStringLiteral("d MMM, yyyy hh:mm"), + QStringLiteral("d MMM, yyyy hh:mm:ss"), + + QStringLiteral("d MMMM, yyyy"), + QStringLiteral("d MMMM, yyyy hh:mm"), + QStringLiteral("d MMMM, yyyy hh:mm:ss"), + }; + + for (uint i = 0; i < sizeof(formats) / sizeof(formats[0]); ++i) { + const QString &format(formats[i]); + dt = format.indexOf(QLatin1String("hh:mm")) < 0 + ? QDateTime(QDate::fromString(s, format), + QTime(0, 0, 0), Qt::UTC) + : QDateTime::fromString(s, format); // as local time if (dt.isValid()) break; } @@ -561,7 +618,7 @@ static inline QDateTime ToDateTime(double t, Qt::TimeSpec spec) { if (std::isnan(t)) return QDateTime(); - return QDateTime::fromMSecsSinceEpoch(t, spec); + return QDateTime::fromMSecsSinceEpoch(t, Qt::UTC).toTimeSpec(spec); } static inline QString ToString(double t) @@ -619,20 +676,28 @@ static inline QString ToLocaleTimeString(double t) static double getLocalTZA() { #ifndef Q_OS_WIN + tzset(); +#endif +#ifdef USE_QTZ_SYSTEM_ZONE + // TODO: QTimeZone::resetSystemTimeZone(), see QTBUG-56899 and comment above. + // Standard offset, with no daylight-savings adjustment, in ms: + return QTimeZone::systemTimeZone().standardTimeOffset(QDateTime::currentDateTime()) * 1e3; +#else +# ifdef Q_OS_WIN + TIME_ZONE_INFORMATION tzInfo; + GetTimeZoneInformation(&tzInfo); + return -tzInfo.Bias * 60.0 * 1000.0; +# else struct tm t; time_t curr; - tzset(); time(&curr); - localtime_r(&curr, &t); + localtime_r(&curr, &t); // Wrong: includes DST offset time_t locl = mktime(&t); gmtime_r(&curr, &t); time_t globl = mktime(&t); return (double(locl) - double(globl)) * 1000.0; -#else - TIME_ZONE_INFORMATION tzInfo; - GetTimeZoneInformation(&tzInfo); - return -tzInfo.Bias * 60.0 * 1000.0; -#endif +# endif +#endif // USE_QTZ_SYSTEM_ZONE } DEFINE_OBJECT_VTABLE(DateObject); @@ -651,17 +716,19 @@ void Heap::DateObject::init(const QTime &time) return; } - /* All programmers know that stuff starts at 0. Whatever that may mean in this context (and - * local timezone), it's before the epoch, so there is defenitely no DST problem. Specifically: - * you can't start with a date before the epoch, add some[*] hours, and end up with a date - * after. That's a problem for timezones where new year happens during DST, like - * Australia/Hobart, because we have to ignore DST before the epoch (but honor it after the - * epoch). - * - * [*] Well, when "some" is in the range 0-24. If you add something like 1M then this might - * still happen. + /* We have to chose a date on which to instantiate this time. All we really + * care about is that it round-trips back to the same time if we extract the + * time from it, which shall (via toQDateTime(), below) discard the date + * part. We need a date for which time-zone data is likely to be sane (so + * MakeDay(0, 0, 0) was a bad choice; 2 BC, December 31st is before + * time-zones were standardized), with no transition nearby in date. We + * ignore DST transitions before 1970, but even then zone transitions did + * happen. Some do happen at new year, others on DST transitions in spring + * and autumn; so pick the three hundredth anniversary of the birth of + * Giovanni Domenico Cassini (1625-06-08), whose work first let us + * synchronize clocks tolerably accurately at distant locations. */ - static const double d = MakeDay(0, 0, 0); + static const double d = MakeDay(1925, 5, 8); double t = MakeTime(time.hour(), time.minute(), time.second(), time.msec()); date = TimeClip(UTC(MakeDate(d, t))); } diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h index 8e2eec03d2..61a55964ab 100644 --- a/src/qml/jsruntime/qv4debugging_p.h +++ b/src/qml/jsruntime/qv4debugging_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE namespace QV4 { namespace Debugging { -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) class Debugger { diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index beb856c2f6..c57f39f61c 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -488,7 +488,7 @@ ExecutionEngine::~ExecutionEngine() delete [] argumentsAccessors; } -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) void ExecutionEngine::setDebugger(Debugging::Debugger *debugger) { Q_ASSERT(!m_debugger); @@ -500,7 +500,7 @@ void ExecutionEngine::setProfiler(Profiling::Profiler *profiler) Q_ASSERT(!m_profiler); m_profiler.reset(profiler); } -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) void ExecutionEngine::initRootContext() { @@ -1326,7 +1326,7 @@ QV4::ReturnedValue QV4::ExecutionEngine::fromVariant(const QVariant &variant) case QMetaType::QDateTime: return QV4::Encode(newDateObject(*reinterpret_cast<const QDateTime *>(ptr))); case QMetaType::QDate: - return QV4::Encode(newDateObject(QDateTime(*reinterpret_cast<const QDate *>(ptr)))); + return QV4::Encode(newDateObject(QDateTime(*reinterpret_cast<const QDate *>(ptr), QTime(0, 0, 0), Qt::UTC))); case QMetaType::QTime: return QV4::Encode(newDateObjectFromTime(*reinterpret_cast<const QTime *>(ptr))); case QMetaType::QRegExp: diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 148dec44bd..e143fe2de2 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -369,7 +369,7 @@ public: ExecutionEngine(); ~ExecutionEngine(); -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) QV4::Debugging::Debugger *debugger() const { return nullptr; } QV4::Profiling::Profiler *profiler() const { return nullptr; } @@ -381,7 +381,7 @@ public: void setDebugger(Debugging::Debugger *debugger); void setProfiler(Profiling::Profiler *profiler); -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) void setCurrentContext(Heap::ExecutionContext *context); ExecutionContext *currentContext() const { @@ -480,7 +480,7 @@ public: static bool canJIT(); private: -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) QScopedPointer<QV4::Debugging::Debugger> m_debugger; QScopedPointer<QV4::Profiling::Profiler> m_profiler; #endif diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h index 9b71342467..8a24c71815 100644 --- a/src/qml/jsruntime/qv4profiling_p.h +++ b/src/qml/jsruntime/qv4profiling_p.h @@ -57,7 +57,7 @@ #include <QElapsedTimer> -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) QT_BEGIN_NAMESPACE @@ -288,6 +288,6 @@ Q_DECLARE_METATYPE(QV4::Profiling::FunctionLocationHash) Q_DECLARE_METATYPE(QVector<QV4::Profiling::FunctionCallProperties>) Q_DECLARE_METATYPE(QVector<QV4::Profiling::MemoryAllocationProperties>) -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) #endif // QV4PROFILING_H diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index e2071986a5..adf43812cf 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -141,7 +141,7 @@ Q_QML_EXPORT int qt_v4DebuggerHook(const char *json); } // extern "C" -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) static int qt_v4BreakpointCount = 0; static bool qt_v4IsDebugging = false; static bool qt_v4IsStepping = false; @@ -287,7 +287,7 @@ Q_NEVER_INLINE static void debug_slowPath(QV4::ExecutionEngine *engine) qt_v4CheckForBreak(engine->currentStackFrame); } -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) // End of debugger interface using namespace QV4; @@ -1343,12 +1343,12 @@ QV4::ReturnedValue VME::exec(const FunctionObject *fo, const Value *thisObject, goto functionExit; MOTH_END_INSTR(Ret) -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) MOTH_BEGIN_INSTR(Debug) STORE_IP(); debug_slowPath(engine); MOTH_END_INSTR(Debug) -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) MOTH_BEGIN_INSTR(LoadQmlContext) STACK_VALUE(result) = Runtime::method_loadQmlContext(static_cast<QV4::NoThrowEngine*>(engine)); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index a3fe4cad0f..9ef47b2c2e 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -667,7 +667,7 @@ the same object as is returned from the Qt.include() call. QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e) : propertyCapture(0), rootContext(0), -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) profiler(0), #endif outputWarningsToMsgLog(true), @@ -711,7 +711,7 @@ QQmlEnginePrivate::~QQmlEnginePrivate() QMetaType::unregisterType(iter.value()->metaTypeId); QMetaType::unregisterType(iter.value()->listMetaTypeId); } -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) delete profiler; #endif } diff --git a/src/qml/qml/qqmlengine.h b/src/qml/qml/qqmlengine.h index b775054253..937920e191 100644 --- a/src/qml/qml/qqmlengine.h +++ b/src/qml/qml/qqmlengine.h @@ -46,7 +46,6 @@ #include <QtQml/qjsengine.h> #include <QtQml/qqml.h> #include <QtQml/qqmlerror.h> -#include <QtQml/qqmldebug.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index fd74a233a4..791660cac7 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -135,7 +135,7 @@ public: QQmlContext *rootContext; -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) static const quintptr profiler = 0; #else QQmlProfiler *profiler; diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 00bfb65a66..55e05afdaa 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -963,7 +963,7 @@ void QQmlTypeLoader::invalidate() #endif // qml_network } -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) void QQmlTypeLoader::setProfiler(QQmlProfiler *profiler) { Q_ASSERT(!m_profiler); diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index ef63e02b4f..94552cd5a0 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -321,13 +321,13 @@ public: void initializeEngine(QQmlExtensionInterface *, const char *); void invalidate(); -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) quintptr profiler() const { return 0; } void setProfiler(quintptr) {} #else QQmlProfiler *profiler() const { return m_profiler.data(); } void setProfiler(QQmlProfiler *profiler); -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) private: @@ -379,7 +379,7 @@ private: QQmlEngine *m_engine; QQmlTypeLoaderThread *m_thread; -#ifndef QT_NO_QML_DEBUGGER +#if QT_CONFIG(qml_debug) QScopedPointer<QQmlProfiler> m_profiler; #endif diff --git a/src/qml/qtqmlglobal.h b/src/qml/qtqmlglobal.h index 387c28a945..6e92867cf5 100644 --- a/src/qml/qtqmlglobal.h +++ b/src/qml/qtqmlglobal.h @@ -50,6 +50,8 @@ # if QT_CONFIG(qml_network) # include <QtNetwork/qtnetworkglobal.h> # endif +#else +# define QT_FEATURE_qml_debug -1 #endif QT_BEGIN_NAMESPACE diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro index d13e162ff4..48546d5f64 100644 --- a/src/qmltest/qmltest.pro +++ b/src/qmltest/qmltest.pro @@ -30,6 +30,6 @@ HEADERS += \ $$PWD/quicktestresult_p.h \ $$PWD/qtestoptions_p.h -!contains(QT_CONFIG, no-qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING +qtConfig(qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING load(qt_module) diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 869fdeadc8..62312845b2 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -404,7 +404,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickText, 10>(uri, 2, 10, "Text"); #if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPathAngleArc, 2>(uri, 2, 11, "PathAngleArc"); + qmlRegisterType<QQuickPathAngleArc>(uri, 2, 11, "PathAngleArc"); #endif } diff --git a/src/quick/items/qquickview.h b/src/quick/items/qquickview.h index 142607fa39..014d02e7f5 100644 --- a/src/quick/items/qquickview.h +++ b/src/quick/items/qquickview.h @@ -42,7 +42,6 @@ #include <QtQuick/qquickwindow.h> #include <QtCore/qurl.h> -#include <QtQml/qqmldebug.h> QT_BEGIN_NAMESPACE diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index 58cfff5ace..e5b54c8fb9 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -47,6 +47,7 @@ #include <QtGui/qwindow.h> #include <QtGui/qevent.h> #include <QtQml/qqml.h> +#include <QtQml/qqmldebug.h> QT_BEGIN_NAMESPACE diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index c6b89fabd3..00fc23645b 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -62,7 +62,7 @@ static void initResources() QT_BEGIN_NAMESPACE -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) class QQmlQtQuick2DebugStatesDelegate : public QQmlDebugStatesDelegate {}; @@ -181,7 +181,7 @@ void QQmlQtQuick2DebugStatesDelegate::resetBindingForInvalidProperty(QObject *ob } } -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) void QQmlQtQuick2Module::defineModule() { diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index d016e79641..0da35fba42 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -55,6 +55,7 @@ #include <QtGui/QOpenGLFunctions_1_0> #include <QtGui/QOpenGLFunctions_3_2_Core> +#include <private/qnumeric_p.h> #include <private/qquickprofiler_p.h> #include "qsgmaterialshader_p.h" diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index d2fa935ad4..38027a6abf 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -52,9 +52,12 @@ // #include <QtCore/private/qabstractanimation_p.h> -#include <QtQml/private/qqmlprofilerdefinitions_p.h> #include <QtQuick/private/qtquickglobal_p.h> +#if QT_CONFIG(qml_debug) +#include <QtQml/private/qqmlprofilerdefinitions_p.h> +#endif + #include <QtCore/qurl.h> #include <QtCore/qsize.h> #include <QtCore/qmutex.h> @@ -62,7 +65,7 @@ QT_BEGIN_NAMESPACE -#ifdef QT_NO_QML_DEBUGGER +#if !QT_CONFIG(qml_debug) #define Q_QUICK_PROFILE_IF_ENABLED(feature, Code) @@ -358,7 +361,7 @@ protected: void setTimer(const QElapsedTimer &t); }; -#endif // QT_NO_QML_DEBUGGER +#endif // QT_CONFIG(qml_debug) #define Q_QUICK_PROFILE(feature, Method)\ Q_QUICK_PROFILE_IF_ENABLED(feature, QQuickProfiler::Method) diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri index b53b132cce..edcb268cd9 100644 --- a/src/quick/util/util.pri +++ b/src/quick/util/util.pri @@ -28,7 +28,7 @@ SOURCES += \ $$PWD/qquicktextmetrics.cpp \ $$PWD/qquickvalidator.cpp -!contains(QT_CONFIG, no-qml-debug): SOURCES += $$PWD/qquickprofiler.cpp +qtConfig(qml-debug): SOURCES += $$PWD/qquickprofiler.cpp HEADERS += \ $$PWD/qquickapplication_p.h\ diff --git a/src/quickwidgets/qquickwidget.h b/src/quickwidgets/qquickwidget.h index e7fbc62967..8c9382e84b 100644 --- a/src/quickwidgets/qquickwidget.h +++ b/src/quickwidgets/qquickwidget.h @@ -43,7 +43,6 @@ #include <QtWidgets/qwidget.h> #include <QtQuick/qquickwindow.h> #include <QtCore/qurl.h> -#include <QtQml/qqmldebug.h> #include <QtQuickWidgets/qtquickwidgetsglobal.h> #include <QtGui/qimage.h> diff --git a/src/src.pro b/src/src.pro index 3bb399acd4..42bf90e092 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,7 +1,8 @@ TEMPLATE = subdirs CONFIG += ordered +include($$OUT_PWD/qml/qtqml-config.pri) include($$OUT_PWD/quick/qtquick-config.pri) -QT_FOR_CONFIG += network quick-private +QT_FOR_CONFIG += network qml quick-private SUBDIRS += \ qml @@ -20,4 +21,4 @@ SUBDIRS += \ imports \ qmldevtools -qtConfig(localserver):!contains(QT_CONFIG, no-qml-debug): SUBDIRS += qmldebug +qtConfig(localserver):qtConfig(qml-debug): SUBDIRS += qmldebug diff --git a/tests/auto/qml/ecmascripttests/test262.py b/tests/auto/qml/ecmascripttests/test262.py index 437cd1b27d..ae4c54df9d 100755 --- a/tests/auto/qml/ecmascripttests/test262.py +++ b/tests/auto/qml/ecmascripttests/test262.py @@ -552,10 +552,10 @@ class TestSuite(object): def Main(): - # Some date tests rely on being run in pacific time. # Uncomment the next line for more logging info. #logging.basicConfig(level=logging.DEBUG) - os.environ["TZ"] = "PST8PDT" + # Some date tests rely on being run in pacific time and the USA's locale: + os.environ["TZ"] = "America/Vancouver" os.environ["LANG"] = "en_US.UTF-8" os.environ["LC_TIME"] = "en_US.UTF-8" parser = BuildOptions() diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 4bb3ca2d4e..8471d6466f 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += qml METATYPETESTS += \ qqmlmetatype @@ -81,8 +82,7 @@ qtHaveModule(widgets) { SUBDIRS += $$PUBLICTESTS SUBDIRS += $$METATYPETESTS qtConfig(process) { - # qtConfig(qml-debug): - SUBDIRS += debugger + qtConfig(qml-debug): SUBDIRS += debugger !boot2qt { SUBDIRS += qmllint qmlplugindump } diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.1.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.1.qml index efca6cdb80..8912d2a314 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.1.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.1.qml @@ -11,25 +11,26 @@ MyTypeObject { dateTimeProperty = dateTimeVar dateTimeProperty2 = dateTimeVar2 - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getUTCDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && - (dateTimeProperty.getMinutes() == 0) && - (dateTimeProperty.getSeconds() == 1) && + (dateTimeProperty.getUTCDate() == 12) && + (dateTimeProperty.getUTCHours() == 0) && + (dateTimeProperty.getUTCMinutes() == 0) && + (dateTimeProperty.getUTCSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && - (dateTimeProperty2.getMinutes() == 59) && - (dateTimeProperty2.getSeconds() == 59) + (dateTimeProperty2.getUTCDate() == 12) && + (dateTimeProperty2.getUTCHours() == 23) && + (dateTimeProperty2.getUTCMinutes() == 59) && + (dateTimeProperty2.getUTCSeconds() == 59) } } diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.2.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.2.qml index 71dd188f05..f8c1f6eb8f 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.2.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.2.qml @@ -12,24 +12,25 @@ MyTypeObject { var dateTimeVar = new Date("2009-05-12T00:00:01") var dateTimeVar2 = new Date("2009-05-12T23:59:59") - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getUTCDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && + (dateTimeProperty.getDate() == 12) && + (dateTimeProperty.getHours() == 0) && (dateTimeProperty.getMinutes() == 0) && (dateTimeProperty.getSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && + (dateTimeProperty2.getDate() == 12) && + (dateTimeProperty2.getHours() == 23) && (dateTimeProperty2.getMinutes() == 59) && (dateTimeProperty2.getSeconds() == 59) } diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.3.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.3.qml index 2cf740645c..e960eef193 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.3.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.3.qml @@ -2,35 +2,36 @@ import Qt.test 1.0 import QtQuick 2.0 MyTypeObject { - dateProperty: if (1) "2009-05-12Z" + dateProperty: if (1) "2009-05-12" dateTimeProperty: if (1) "2009-05-12T00:00:01Z" dateTimeProperty2: if (1) "2009-05-12T23:59:59Z" boolProperty: false Component.onCompleted: { - var dateVar = new Date("2009-05-12Z") + var dateVar = new Date("2009-05-12") var dateTimeVar = new Date("2009-05-12T00:00:01Z") var dateTimeVar2 = new Date("2009-05-12T23:59:59Z") - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getUTCDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && - (dateTimeProperty.getMinutes() == 0) && - (dateTimeProperty.getSeconds() == 1) && + (dateTimeProperty.getUTCDate() == 12) && + (dateTimeProperty.getUTCHours() == 0) && + (dateTimeProperty.getUTCMinutes() == 0) && + (dateTimeProperty.getUTCSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && - (dateTimeProperty2.getMinutes() == 59) && - (dateTimeProperty2.getSeconds() == 59) + (dateTimeProperty2.getUTCDate() == 12) && + (dateTimeProperty2.getUTCHours() == 23) && + (dateTimeProperty2.getUTCMinutes() == 59) && + (dateTimeProperty2.getUTCSeconds() == 59) } } diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.4.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.4.qml index 9b4975c833..6dd29afbc9 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.4.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.4.qml @@ -2,35 +2,36 @@ import Qt.test 1.0 import QtQuick 2.0 MyTypeObject { - dateProperty: if (1) new Date("2009-05-12Z") + dateProperty: if (1) new Date("2009-05-12") dateTimeProperty: if (1) new Date("2009-05-12T00:00:01Z") dateTimeProperty2: if (1) new Date("2009-05-12T23:59:59Z") boolProperty: false Component.onCompleted: { - var dateVar = new Date("2009-05-12Z") + var dateVar = new Date("2009-05-12") var dateTimeVar = new Date("2009-05-12T00:00:01Z") var dateTimeVar2 = new Date("2009-05-12T23:59:59Z") - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getUTCDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && - (dateTimeProperty.getMinutes() == 0) && - (dateTimeProperty.getSeconds() == 1) && + (dateTimeProperty.getUTCDate() == 12) && + (dateTimeProperty.getUTCHours() == 0) && + (dateTimeProperty.getUTCMinutes() == 0) && + (dateTimeProperty.getUTCSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && - (dateTimeProperty2.getMinutes() == 59) && - (dateTimeProperty2.getSeconds() == 59) + (dateTimeProperty2.getUTCDate() == 12) && + (dateTimeProperty2.getUTCHours() == 23) && + (dateTimeProperty2.getUTCMinutes() == 59) && + (dateTimeProperty2.getUTCSeconds() == 59) } } diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.5.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.5.qml index 2cf740645c..cfadaafc54 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.5.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.5.qml @@ -2,35 +2,36 @@ import Qt.test 1.0 import QtQuick 2.0 MyTypeObject { - dateProperty: if (1) "2009-05-12Z" - dateTimeProperty: if (1) "2009-05-12T00:00:01Z" - dateTimeProperty2: if (1) "2009-05-12T23:59:59Z" + dateProperty: if (1) "2009-05-12" + dateTimeProperty: if (1) "2009-05-12T00:00:01+02:00" + dateTimeProperty2: if (1) "2009-05-12T23:59:59+02:00" boolProperty: false Component.onCompleted: { - var dateVar = new Date("2009-05-12Z") - var dateTimeVar = new Date("2009-05-12T00:00:01Z") - var dateTimeVar2 = new Date("2009-05-12T23:59:59Z") + var dateVar = new Date("2009-05-12") + var dateTimeVar = new Date("2009-05-12T00:00:01+02:00") + var dateTimeVar2 = new Date("2009-05-12T23:59:59+02:00") - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getUTCDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && - (dateTimeProperty.getMinutes() == 0) && - (dateTimeProperty.getSeconds() == 1) && + (dateTimeProperty.getUTCDate() == 11) && + (dateTimeProperty.getUTCHours() == 22) && + (dateTimeProperty.getUTCMinutes() == 0) && + (dateTimeProperty.getUTCSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && - (dateTimeProperty2.getMinutes() == 59) && - (dateTimeProperty2.getSeconds() == 59) + (dateTimeProperty2.getUTCDate() == 12) && + (dateTimeProperty2.getUTCHours() == 21) && + (dateTimeProperty2.getUTCMinutes() == 59) && + (dateTimeProperty2.getUTCSeconds() == 59) } } diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.6.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.6.qml index 73e26db0c8..97cd0d1e60 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.6.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.6.qml @@ -3,34 +3,35 @@ import QtQuick 2.0 MyTypeObject { dateProperty: if (1) new Date("2009-05-12") - dateTimeProperty: if (1) new Date("2009-05-12T02:00:01+02:00") - dateTimeProperty2: if (1) new Date("2009-05-13T01:59:59+02:00") + dateTimeProperty: if (1) new Date("2009-05-12T00:00:01+02:00") + dateTimeProperty2: if (1) new Date("2009-05-12T23:59:59+02:00") boolProperty: false Component.onCompleted: { var dateVar = new Date("2009-05-12") - var dateTimeVar = new Date("2009-05-12T02:00:01+02:00") - var dateTimeVar2 = new Date("2009-05-13T01:59:59+02:00") + var dateTimeVar = new Date("2009-05-12T00:00:01+02:00") + var dateTimeVar2 = new Date("2009-05-12T23:59:59+02:00") - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getUTCDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && - (dateTimeProperty.getMinutes() == 0) && - (dateTimeProperty.getSeconds() == 1) && + (dateTimeProperty.getUTCDate() == 11) && + (dateTimeProperty.getUTCHours() == 22) && + (dateTimeProperty.getUTCMinutes() == 0) && + (dateTimeProperty.getUTCSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && - (dateTimeProperty2.getMinutes() == 59) && - (dateTimeProperty2.getSeconds() == 59) + (dateTimeProperty2.getUTCDate() == 12) && + (dateTimeProperty2.getUTCHours() == 21) && + (dateTimeProperty2.getUTCMinutes() == 59) && + (dateTimeProperty2.getUTCSeconds() == 59) } } diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.qml index 14fe20787b..73677e99f1 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.qml @@ -7,28 +7,31 @@ MyTypeObject { var dateTimeVar = new Date("2009-05-12T00:00:01") var dateTimeVar2 = new Date("2009-05-12T23:59:59") + // Date, with no zone specified, is implicitly UTC dateProperty = dateVar + // Date-time, with no zone, is implicitly local-time dateTimeProperty = dateTimeVar dateTimeProperty2 = dateTimeVar2 - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && + (dateTimeProperty.getDate() == 12) && + (dateTimeProperty.getHours() == 0) && (dateTimeProperty.getMinutes() == 0) && (dateTimeProperty.getSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && + (dateTimeProperty2.getDate() == 12) && + (dateTimeProperty2.getHours() == 23) && (dateTimeProperty2.getMinutes() == 59) && (dateTimeProperty2.getSeconds() == 59) } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index a4b7b8089f..4415e6cf74 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -446,29 +446,37 @@ void tst_qqmlecmascript::assignBasicTypes() void tst_qqmlecmascript::assignDate_data() { QTest::addColumn<QUrl>("source"); + QTest::addColumn<int>("timeOffset"); // -1 for local-time, else minutes from UTC - QTest::newRow("Component.onComplete JS Parse") << testFileUrl("assignDate.qml"); - QTest::newRow("Component.onComplete JS") << testFileUrl("assignDate.1.qml"); - QTest::newRow("Binding JS") << testFileUrl("assignDate.2.qml"); - QTest::newRow("Binding UTC") << testFileUrl("assignDate.3.qml"); - QTest::newRow("Binding JS UTC") << testFileUrl("assignDate.4.qml"); - QTest::newRow("Binding UTC+2") << testFileUrl("assignDate.5.qml"); - QTest::newRow("Binding JS UTC+2 ") << testFileUrl("assignDate.6.qml"); + QTest::newRow("Component.onComplete JS Parse") << testFileUrl("assignDate.qml") << -1; + QTest::newRow("Component.onComplete JS") << testFileUrl("assignDate.1.qml") << 0; + QTest::newRow("Binding JS") << testFileUrl("assignDate.2.qml") << -1; + QTest::newRow("Binding UTC") << testFileUrl("assignDate.3.qml") << 0; + QTest::newRow("Binding JS UTC") << testFileUrl("assignDate.4.qml") << 0; + QTest::newRow("Binding UTC+2") << testFileUrl("assignDate.5.qml") << 120; + QTest::newRow("Binding JS UTC+2 ") << testFileUrl("assignDate.6.qml") << 120; } void tst_qqmlecmascript::assignDate() { QFETCH(QUrl, source); + QFETCH(int, timeOffset); QQmlComponent component(&engine, source); QScopedPointer<QObject> obj(component.create()); MyTypeObject *object = qobject_cast<MyTypeObject *>(obj.data()); QVERIFY(object != 0); - // Dates received from JS are automatically converted to local time - QDate expectedDate(QDateTime(QDate(2009, 5, 12), QTime(0, 0, 0), Qt::UTC).toLocalTime().date()); - QDateTime expectedDateTime(QDateTime(QDate(2009, 5, 12), QTime(0, 0, 1), Qt::UTC).toLocalTime()); - QDateTime expectedDateTime2(QDateTime(QDate(2009, 5, 12), QTime(23, 59, 59), Qt::UTC).toLocalTime()); + QDate expectedDate(2009, 5, 12); + QDateTime expectedDateTime; + QDateTime expectedDateTime2; + if (timeOffset == -1) { + expectedDateTime = QDateTime(QDate(2009, 5, 12), QTime(0, 0, 1), Qt::LocalTime); + expectedDateTime2 = QDateTime(QDate(2009, 5, 12), QTime(23, 59, 59), Qt::LocalTime); + } else { + expectedDateTime = QDateTime(QDate(2009, 5, 12), QTime(0, 0, 1), Qt::OffsetFromUTC, timeOffset * 60); + expectedDateTime2 = QDateTime(QDate(2009, 5, 12), QTime(23, 59, 59), Qt::OffsetFromUTC, timeOffset * 60); + } QCOMPARE(object->dateProperty(), expectedDate); QCOMPARE(object->dateTimeProperty(), expectedDateTime); @@ -7285,8 +7293,8 @@ class WeakReferenceMutator : public QObject Q_OBJECT public: WeakReferenceMutator() - : resultPtr(Q_NULLPTR) - , weakRef(Q_NULLPTR) + : resultPtr(nullptr) + , weakRef(nullptr) {} void init(QV4::ExecutionEngine *v4, QV4::WeakValue *weakRef, bool *resultPtr) diff --git a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp index 268010ead8..2511eebefe 100644 --- a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp +++ b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp @@ -105,7 +105,7 @@ void tst_qqmlextensionplugin::iidCheck() QPluginLoader loader(filePath); QVERIFY2(loader.load(), qPrintable(loader.errorString())); - QVERIFY(loader.instance() != Q_NULLPTR); + QVERIFY(loader.instance() != nullptr); if (qobject_cast<QQmlExtensionPlugin *>(loader.instance())) { QString iid = loader.metaData().value(QStringLiteral("IID")).toString(); diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index d0ce83b997..4f4deaafe5 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -1268,8 +1268,8 @@ void tst_qqmllocale::timeZoneUpdated() { QByteArray original(qgetenv("TZ")); - // Set the timezone to Brisbane time - setTimeZone(QByteArray("AEST-10:00")); + // Set the timezone to Brisbane time, AEST-10:00 + setTimeZone(QByteArray("Australia/Brisbane")); DateFormatter formatter; @@ -1281,8 +1281,8 @@ void tst_qqmllocale::timeZoneUpdated() QVERIFY(obj); QVERIFY(obj->property("success").toBool()); - // Change to Indian time - setTimeZone(QByteArray("IST-05:30")); + // Change to Indian time, IST-05:30 + setTimeZone(QByteArray("Asia/Kolkata")); QMetaObject::invokeMethod(obj.data(), "check"); diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 0576650d01..0bc1127069 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -888,7 +888,8 @@ void tst_qqmlqt::dateTimeFormattingVariants_data() QTest::newRow("formatTime, qtime") << "formatTime" << QVariant::fromValue(time) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); QDate date(2011,5,31); - temporary = QDateTime(date); + // V4 reads the date in UTC but DateObject::toQDateTime() gives it back in local time: + temporary = QDateTime(date, QTime(0, 0, 0), Qt::UTC).toLocalTime(); QTest::newRow("formatDate, qdate") << "formatDate" << QVariant::fromValue(date) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy")); QTest::newRow("formatDateTime, qdate") << "formatDateTime" << QVariant::fromValue(date) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a")); QTest::newRow("formatTime, qdate") << "formatTime" << QVariant::fromValue(date) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); @@ -997,7 +998,7 @@ void tst_qqmlqt::exit() QSignalSpy spy(&engine, &QQmlEngine::exit); QObject *object = component.create(); - QVERIFY(object != Q_NULLPTR); + QVERIFY(object != nullptr); QCOMPARE(spy.count(), 1); QList<QVariant> arguments = spy.takeFirst(); QVERIFY(arguments.at(0).toInt() == object->property("returnCode").toInt()); diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp index a8a6456dff..59716acc0d 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp +++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp @@ -291,7 +291,7 @@ class TestThreadedHTTPServer : public QObject Q_OBJECT public: TestThreadedHTTPServer(const QUrl &expectUrl, const QUrl &replyUrl, const QUrl &bodyUrl) - : m_server(Q_NULLPTR) { + : m_server(nullptr) { QMutexLocker locker(&m_lock); moveToThread(&m_thread); m_thread.start(); diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index 140a3b583e..e7303604b4 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -147,9 +147,9 @@ public: int DummyRenderer::globalRendereringOrder; NodesTest::NodesTest() - : surface(Q_NULLPTR) - , context(Q_NULLPTR) - , renderContext(Q_NULLPTR) + : surface(nullptr) + , context(nullptr) + , renderContext(nullptr) { } diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 2b14842658..9bba6c9291 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -6650,7 +6650,7 @@ void tst_QQuickGridView::QTBUG_48870_fastModelUpdates() QQuickItemViewPrivate *priv = QQuickItemViewPrivate::get(view); bool nonUnique; - FxViewItem *item = Q_NULLPTR; + FxViewItem *item = nullptr; int expectedIdx; QVERIFY(testVisibleItems(priv, &nonUnique, &item, &expectedIdx)); diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 00aa5ef726..b66dc1708f 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -301,7 +301,7 @@ class TabFenceItem : public QQuickItem Q_OBJECT public: - TabFenceItem(QQuickItem *parent = Q_NULLPTR) + TabFenceItem(QQuickItem *parent = nullptr) : QQuickItem(parent) { QQuickItemPrivate *d = QQuickItemPrivate::get(this); @@ -316,7 +316,7 @@ class TabFenceItem2 : public QQuickItem Q_OBJECT public: - TabFenceItem2(QQuickItem *parent = Q_NULLPTR) + TabFenceItem2(QQuickItem *parent = nullptr) : QQuickItem(parent) { QQuickItemPrivate *d = QQuickItemPrivate::get(this); @@ -1188,12 +1188,12 @@ void tst_QQuickItem::tabFence() QVERIFY(window->rootObject()->hasActiveFocus()); const char *rootTabFocusChain[] = { - "input1", "input2", "input3", "input1", Q_NULLPTR + "input1", "input2", "input3", "input1", nullptr }; verifyTabFocusChain(window, rootTabFocusChain, true /* forward */); const char *rootBacktabFocusChain[] = { - "input3", "input2", "input1", "input3", Q_NULLPTR + "input3", "input2", "input1", "input3", nullptr }; verifyTabFocusChain(window, rootBacktabFocusChain, false /* forward */); @@ -1204,12 +1204,12 @@ void tst_QQuickItem::tabFence() QVERIFY(item->hasActiveFocus()); const char *fence1TabFocusChain[] = { - "input12", "input13", "input11", "input12", Q_NULLPTR + "input12", "input13", "input11", "input12", nullptr }; verifyTabFocusChain(window, fence1TabFocusChain, true /* forward */); const char *fence1BacktabFocusChain[] = { - "input11", "input13", "input12", "input11", Q_NULLPTR + "input11", "input13", "input12", "input11", nullptr }; verifyTabFocusChain(window, fence1BacktabFocusChain, false /* forward */); } diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 0d0f234d33..511a95f04f 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -8485,7 +8485,7 @@ void tst_QQuickListView::QTBUG_48870_fastModelUpdates() QQuickItemViewPrivate *priv = QQuickItemViewPrivate::get(listview); bool nonUnique; - FxViewItem *item = Q_NULLPTR; + FxViewItem *item = nullptr; int expectedIdx; QVERIFY(testVisibleItems(priv, &nonUnique, &item, &expectedIdx)); diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index cbef0fcc8d..061f71aeb0 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -2351,7 +2351,7 @@ void tst_QQuickPathView::qtbug37815() QTest::qWait(1000); QQuickPathView *pathView = findItem<QQuickPathView>(window->rootObject(), "pathView"); - QVERIFY(pathView != Q_NULLPTR); + QVERIFY(pathView != nullptr); const int pathItemCount = pathView->pathItemCount(); const int cacheItemCount = pathView->cacheItemCount(); @@ -2421,7 +2421,7 @@ void tst_QQuickPathView::qtbug53464() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickPathView *pathView = findItem<QQuickPathView>(window->rootObject(), "pathView"); - QVERIFY(pathView != Q_NULLPTR); + QVERIFY(pathView != nullptr); const int currentIndex = pathView->currentIndex(); QCOMPARE(currentIndex, 8); diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 3aa8af18bc..04704f9314 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -14,6 +14,6 @@ mac { ICON = qml.icns } -!contains(QT_CONFIG, no-qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING +qtConfig(qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING load(qt_tool) diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro index 6a7df90ccc..dcc46e17c7 100644 --- a/tools/qmlscene/qmlscene.pro +++ b/tools/qmlscene/qmlscene.pro @@ -5,7 +5,7 @@ CONFIG += no_import_scan SOURCES += main.cpp DEFINES += QML_RUNTIME_TESTING -!contains(QT_CONFIG, no-qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING +qtConfig(qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING QMAKE_TARGET_DESCRIPTION = QML Scene Viewer |