diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-07-14 01:02:04 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-16 09:38:30 +0200 |
commit | 43645fd59c6bcb0a3e37eef530ef970f51ed48af (patch) | |
tree | d377a19c36e9e853377db59b58d937db0ea67e0d /src/qml | |
parent | ad0f200df54e5afcb1fdcb977794259bdb9216b5 (diff) | |
parent | f42207cbdb0cbe5e345bfd9e000b3e77b34a503c (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/quick/items/qquickloader.cpp
tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
Change-Id: I0cb9f637d24ccd0ecfb50c455cc210119f744b02
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/doc/src/cppintegration/data.qdoc | 18 | ||||
-rw-r--r-- | src/qml/doc/src/qtqml-cpp.qdoc | 2 | ||||
-rw-r--r-- | src/qml/parser/qqmljsast.cpp | 22 | ||||
-rw-r--r-- | src/qml/parser/qqmljsast_p.h | 2 |
4 files changed, 34 insertions, 10 deletions
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc index 9d1a03a399..7fb4724f73 100644 --- a/src/qml/doc/src/cppintegration/data.qdoc +++ b/src/qml/doc/src/cppintegration/data.qdoc @@ -247,18 +247,18 @@ Similarly, if a C++ type uses a QDateTime for a property type or method parameter, the value can be created as a JavaScript \c Date object in QML, and is automatically converted to a QDateTime value when it is passed to C++. - -\section2 QTime to JavaScript Date +//! Target adds an anchor, so renaming the section won't break incoming links. +\target QTime to JavaScript Date +\section2 QTime and JavaScript Date The QML engine provides automatic type conversion from QTime values to -JavaScript \c Date objects. The date component of the resulting Date -object should not be relied upon, as it is operating system dependent. -Specifically, the year (and month and day) are set to zero. Conversion -from a JavaScript \c Date object to QTime is done by converting to a -QDateTime, and then relying on QVariant to convert it to a QTime. The end -effect is that the date part of the \c Date object is ignored, but the -local timezone will be used ignoring any DST complications it may have. +JavaScript \c Date objects. As QTime values do not contain a date component, +one is created for the conversion only. Thus, you should not rely on the date +component of the resulting Date object. +Under the hood, conversion from a JavaScript \c Date object to QTime is done by +converting to a QDateTime object and calling its \l {QDateTime::}{time()} +method. \section2 Sequence Type to JavaScript Array diff --git a/src/qml/doc/src/qtqml-cpp.qdoc b/src/qml/doc/src/qtqml-cpp.qdoc index 971bb88825..2c4d2a5ade 100644 --- a/src/qml/doc/src/qtqml-cpp.qdoc +++ b/src/qml/doc/src/qtqml-cpp.qdoc @@ -36,10 +36,12 @@ following directive: \snippet code/doc_src_qtqml.cpp 0 +\if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtqml.pro 0 +\endif For more information on the Qt QML module, see the \l{Qt QML} module documentation. diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp index b8c4a58a13..d254279cbf 100644 --- a/src/qml/parser/qqmljsast.cpp +++ b/src/qml/parser/qqmljsast.cpp @@ -503,6 +503,28 @@ void NumericLiteralPropertyName::accept0(Visitor *visitor) visitor->endVisit(this); } +namespace { +struct LocaleWithoutZeroPadding : public QLocale +{ + LocaleWithoutZeroPadding() + : QLocale(QLocale::C) + { + setNumberOptions(QLocale::OmitLeadingZeroInExponent | QLocale::OmitGroupSeparator); + } +}; +} + +QString NumericLiteralPropertyName::asString()const +{ + // Can't use QString::number here anymore as it does zero padding by default now. + + // In C++11 this initialization is thread-safe (6.7 [stmt.dcl] p4) + static LocaleWithoutZeroPadding locale; + // Because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562 we can't use thread_local + // for the locale variable and therefore rely on toString(double) to be thread-safe. + return locale.toString(id, 'g', 16); +} + void ArrayMemberExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index 2cf2bcb736..07999404b4 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -870,7 +870,7 @@ public: void accept0(Visitor *visitor) override; - QString asString() const override { return QString::number(id, 'g', 16); } + QString asString() const override; // attributes double id; |