diff options
author | Liang Qi <liang.qi@qt.io> | 2017-01-26 00:34:21 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-01-26 00:34:21 +0100 |
commit | 0076c44d3993f377ad6417d3bb08109b608dfbd2 (patch) | |
tree | 498a1f3d0997da8e3959e6a1d47071d56a6ce900 | |
parent | 5f0eab2df3c82a71f70ea5a6535541fa786c6a78 (diff) | |
parent | 9aed949bb99b9bf328322457a02ad1a9fb330f2d (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/quick/util/qquickutilmodule.cpp
tools/qmllint/main.cpp
Change-Id: Ic2283f88c293ca7fc776de3e83eb4c7812309d8a
20 files changed, 178 insertions, 28 deletions
diff --git a/src/3rdparty/masm/wtf/MathExtras.h b/src/3rdparty/masm/wtf/MathExtras.h index 75e3670367..3740d54beb 100644 --- a/src/3rdparty/masm/wtf/MathExtras.h +++ b/src/3rdparty/masm/wtf/MathExtras.h @@ -88,7 +88,7 @@ inline double wtf_ceil(double x) { return copysign(ceil(x), x); } #endif -#if OS(SOLARIS) +#if OS(SOLARIS) && __cplusplus < 201103L namespace std { diff --git a/src/imports/imports.pro b/src/imports/imports.pro index cad02a2980..c49c05956d 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -5,10 +5,10 @@ SUBDIRS += \ qtqml \ folderlistmodel \ localstorage \ - models \ - statemachine + models qtConfig(settings): SUBDIRS += settings +qtConfig(statemachine): SUBDIRS += statemachine qtHaveModule(quick) { SUBDIRS += \ diff --git a/src/imports/layouts/qquickstacklayout.cpp b/src/imports/layouts/qquickstacklayout.cpp index a223dd0374..0bfe63816d 100644 --- a/src/imports/layouts/qquickstacklayout.cpp +++ b/src/imports/layouts/qquickstacklayout.cpp @@ -307,7 +307,11 @@ void QQuickStackLayout::rearrange(const QSizeF &newSize) QQuickItem *item = itemAt(d->currentIndex); Q_ASSERT(item); item->setPosition(QPointF(0,0)); // ### respect alignment? - item->setSize(newSize.expandedTo(hints.min()).boundedTo(hints.max())); + const QSizeF oldSize(item->width(), item->height()); + const QSizeF effectiveNewSize = newSize.expandedTo(hints.min()).boundedTo(hints.max()); + item->setSize(effectiveNewSize); + if (effectiveNewSize == oldSize) + item->polish(); QQuickLayout::rearrange(newSize); } diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h index 3a507bef74..41fb2c5b7b 100644 --- a/src/qml/debugger/qqmlprofiler_p.h +++ b/src/qml/debugger/qqmlprofiler_p.h @@ -73,7 +73,7 @@ struct QQmlProfiler {}; struct QQmlBindingProfiler { - QQmlBindingProfiler(quintptr, QQmlBinding *, QV4::FunctionObject *) {} + QQmlBindingProfiler(quintptr, QV4::Function *) {} }; struct QQmlHandlingSignalProfiler diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc index f32574fcc1..b2bb9ebd18 100644 --- a/src/qml/doc/src/qmltypereference.qdoc +++ b/src/qml/doc/src/qmltypereference.qdoc @@ -89,7 +89,7 @@ provided: \ingroup qtquickbasictypes \brief a date value. -The \c date type refers to a date value. +The \c date type refers to a date value, including the time of the day. To create a \c date value, specify it as a "YYYY-MM-DD" string: @@ -100,7 +100,7 @@ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" } To read a date value returned from a C++ extension class, use \l{QtQml::Qt::formatDate()}{Qt.formatDate()} and \l{QtQml::Qt::formatDateTime()}{Qt.formatDateTime()}. -When integrating with C++, note that any QDate value +When integrating with C++, note that any QDate or QDateTime value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically converted into a \c date value, and vice-versa. diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp index 3fb0815299..f2ae7e117a 100644 --- a/src/qml/jit/qv4regalloc.cpp +++ b/src/qml/jit/qv4regalloc.cpp @@ -973,7 +973,15 @@ private: break; Q_ASSERT(!i->isFixedInterval()); - _liveIntervals.push_back(i); + auto it = _liveIntervals.begin(); + for (; it != _liveIntervals.end(); ++it) { + if ((*it)->temp() == i->temp()) { + *it = i; + break; + } + } + if (it == _liveIntervals.end()) + _liveIntervals.push_back(i); // qDebug() << "-- Activating interval for temp" << i->temp().index; _unprocessedReverseOrder.removeLast(); diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h index dcda949c97..1d8ef4b0fb 100644 --- a/src/qml/jsruntime/qv4internalclass_p.h +++ b/src/qml/jsruntime/qv4internalclass_p.h @@ -234,7 +234,7 @@ struct InternalClassTransition { return id == other.id && flags == other.flags; } bool operator<(const InternalClassTransition &other) const - { return id < other.id; } + { return id < other.id || (id == other.id && flags < other.flags); } }; struct InternalClass : public QQmlJS::Managed { diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 4fbd828307..19ece44beb 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -199,7 +199,7 @@ void QQmlBoundSignalExpression::evaluate(void **a) // for several cases (such as QVariant type and QObject-derived types) //args[ii] = engine->metaTypeToJS(type, a[ii + 1]); if (type == qMetaTypeId<QJSValue>()) { - if (QV4::Value *v4Value = QJSValuePrivate::getValue(reinterpret_cast<QJSValue *>(a[ii + 1]))) + if (QV4::Value *v4Value = QJSValuePrivate::valueForData(reinterpret_cast<QJSValue *>(a[ii + 1]), &callData->args[ii])) callData->args[ii] = *v4Value; else callData->args[ii] = QV4::Encode::undefined(); diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 7b281623fe..cf6f83e5b1 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -108,7 +108,9 @@ public: bool isAccepted() { return event.isAccepted(); } void setAccepted(bool accepted) { event.setAccepted(accepted); } +#if QT_CONFIG(shortcut) Q_REVISION(2) Q_INVOKABLE bool matches(QKeySequence::StandardKey key) const { return event.matches(key); } +#endif private: QKeyEvent event; diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index a1e1ef8c27..7ef75d4b4c 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -337,13 +337,6 @@ QSGNode::~QSGNode() to the scene graph and will cause the preprocess() function to be called for every frame the node is rendered. - The preprocess function is called before the update pass that propagates - opacity and transformations through the scene graph. That means that - functions like QSGOpacityNode::combinedOpacity() and - QSGTransformNode::combinedMatrix() will not contain up-to-date values. - If such values are changed during the preprocess, these changes will be - propagated through the scene graph before it is rendered. - \warning Beware of deleting nodes while they are being preprocessed. It is possible, with a small performance hit, to delete a single node during its own preprocess call. Deleting a subtree which has nodes that also use diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index 77dae0d001..b2e5b84cf4 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -54,7 +54,9 @@ #include "qquicktextmetrics_p.h" #include "qquicktransition_p.h" #include "qquickanimator_p.h" +#if QT_CONFIG(shortcut) #include "qquickshortcut_p.h" +#endif #include "qquickvalidator_p.h" #include <qqmlinfo.h> #include <private/qqmltypenotavailable_p.h> @@ -63,7 +65,9 @@ #include <QtGui/QInputMethod> #include <QtGui/QKeySequence> +#if QT_CONFIG(shortcut) Q_DECLARE_METATYPE(QKeySequence::StandardKey) +#endif void QQuickUtilModule::defineModule() { @@ -114,15 +118,18 @@ void QQuickUtilModule::defineModule() qmlRegisterCustomType<QQuickPropertyChanges>("QtQuick",2,0,"PropertyChanges", new QQuickPropertyChangesParser); +#if QT_CONFIG(shortcut) qRegisterMetaType<QKeySequence::StandardKey>(); qmlRegisterUncreatableType<QKeySequence, 2>("QtQuick", 2, 2, "StandardKey", QStringLiteral("Cannot create an instance of StandardKey.")); +#endif qmlRegisterType<QQuickFontMetrics>("QtQuick", 2, 4, "FontMetrics"); qmlRegisterType<QQuickTextMetrics>("QtQuick", 2, 4, "TextMetrics"); +#if QT_CONFIG(shortcut) qmlRegisterType<QQuickShortcut>("QtQuick", 2, 5, "Shortcut"); - qmlRegisterType<QQuickShortcut,1>("QtQuick", 2, 6, "Shortcut"); qmlRegisterType<QQuickShortcut,9>("QtQuick", 2, 9, "Shortcut"); +#endif } diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri index 1ef1018a31..b53b132cce 100644 --- a/src/quick/util/util.pri +++ b/src/quick/util/util.pri @@ -26,7 +26,6 @@ SOURCES += \ $$PWD/qquickanimatorcontroller.cpp \ $$PWD/qquickfontmetrics.cpp \ $$PWD/qquicktextmetrics.cpp \ - $$PWD/qquickshortcut.cpp \ $$PWD/qquickvalidator.cpp !contains(QT_CONFIG, no-qml-debug): SOURCES += $$PWD/qquickprofiler.cpp @@ -63,9 +62,15 @@ HEADERS += \ $$PWD/qquickprofiler_p.h \ $$PWD/qquickfontmetrics_p.h \ $$PWD/qquicktextmetrics_p.h \ - $$PWD/qquickshortcut_p.h \ $$PWD/qquickvalidator_p.h +qtConfig(shortcut) { + SOURCES += \ + $$PWD/qquickshortcut.cpp + HEADERS += \ + $$PWD/qquickshortcut_p.h +} + qtConfig(quick-path) { SOURCES += \ $$PWD/qquickpath.cpp \ diff --git a/src/src.pro b/src/src.pro index f585ef15ca..21925c9330 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs CONFIG += ordered include($$OUT_PWD/quick/qtquick-config.pri) -QT_FOR_CONFIG += quick-private +QT_FOR_CONFIG += network quick-private SUBDIRS += \ qml @@ -20,6 +20,6 @@ SUBDIRS += \ imports \ qmldevtools -!contains(QT_CONFIG, no-qml-debug): SUBDIRS += qmldebug +qtConfig(localserver):!contains(QT_CONFIG, no-qml-debug): SUBDIRS += qmldebug qmldevtools.CONFIG = host_build diff --git a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp index 1791407934..ff295c5409 100644 --- a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp +++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp @@ -392,8 +392,10 @@ void tst_QPauseAnimationJob::multipleSequentialGroups() #ifdef Q_OS_WIN if (group.state() != QAbstractAnimationJob::Stopped) QEXPECT_FAIL("", winTimerError, Abort); -#endif + QCOMPARE(group.state(), QAbstractAnimationJob::Stopped); +#else QTRY_COMPARE(group.state(), QAbstractAnimationJob::Stopped); +#endif #ifdef Q_OS_WIN if (subgroup1.state() != QAbstractAnimationJob::Stopped) diff --git a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml index 676593096c..54d29dfc94 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml @@ -16,5 +16,11 @@ MyQmlObject onBasicSignal: root.mySignal(10, 19.2, Qt.rgba(1, 1, 0, 1), Qt.rgba(1, 0, 1, 1), MyQmlObject.EnumValue3, Qt.LeftButton) - onQjsValueEmittingSignal: {} + property bool emittedQjsValueWasUndefined + property int emittedQjsValueAsInt + + onQjsValueEmittingSignal: { + emittedQjsValueWasUndefined = value === undefined; + emittedQjsValueAsInt = value + } } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 8c0b0601fc..89dac33671 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -1412,7 +1412,6 @@ void tst_qqmlecmascript::signalParameterTypes() QVERIFY(object != 0); emit object->basicSignal(); - emit object->qjsValueEmittingSignal(QJSValue()); QCOMPARE(object->property("intProperty").toInt(), 10); QCOMPARE(object->property("realProperty").toReal(), 19.2); @@ -1421,6 +1420,12 @@ void tst_qqmlecmascript::signalParameterTypes() QVERIFY(object->property("enumProperty") == MyQmlObject::EnumValue3); QVERIFY(object->property("qtEnumProperty") == Qt::LeftButton); + emit object->qjsValueEmittingSignal(QJSValue()); + QVERIFY(object->property("emittedQjsValueWasUndefined").toBool()); + emit object->qjsValueEmittingSignal(QJSValue(42)); + QVERIFY(!object->property("emittedQjsValueWasUndefined").toBool()); + QCOMPARE(object->property("emittedQjsValueAsInt").value<int>(), 42); + delete object; } diff --git a/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml b/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml new file mode 100644 index 0000000000..8234ac6ef7 --- /dev/null +++ b/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtTest 1.0 +import QtQuick.Layouts 1.3 + +Item { + id: container + width: 200 + height: 200 + TestCase { + id: testCase + name: "Tests_StackLayout" + when: windowShown + width: 200 + height: 200 + + Component { + id: layout_rearrange_Component + + StackLayout { + width: 640 + height: 480 + + property alias testRectangle: testRectangle + + RowLayout { + spacing: 0 + + Rectangle { + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 + } + + Rectangle { + id: testRectangle + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 + visible: false + } + + Item { + Layout.fillWidth: true + } + } + } + } + + function test_rearrange() + { + var layout = layout_rearrange_Component.createObject(container) + compare(layout.testRectangle.x, 0) + layout.testRectangle.visible = true + tryCompare(layout.testRectangle, "x", 100) + + layout.destroy() + } + } +} diff --git a/tests/auto/quick/qquicklayouts/qquicklayouts.pro b/tests/auto/quick/qquicklayouts/qquicklayouts.pro index 9ed3e076be..5079d0a182 100644 --- a/tests/auto/quick/qquicklayouts/qquicklayouts.pro +++ b/tests/auto/quick/qquicklayouts/qquicklayouts.pro @@ -9,5 +9,6 @@ TESTDATA = data/* OTHER_FILES += \ data/tst_rowlayout.qml \ - data/tst_gridlayout.qml + data/tst_gridlayout.qml \ + data/tst_stacklayout.qml diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index 77af4796b6..3e7439f3e9 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -469,7 +469,7 @@ void tst_QQuickLoader::networkComponent() // because in the synchronous case we're already done loading. QTRY_COMPARE(component.status(), QQmlComponent::Ready); - QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); + QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(component.create())); QVERIFY(item); QQuickLoader *loader = qobject_cast<QQuickLoader*>(item->children().at(1)); @@ -481,7 +481,6 @@ void tst_QQuickLoader::networkComponent() QCOMPARE(loader->status(), QQuickLoader::Ready); QCOMPARE(static_cast<QQuickItem*>(loader)->children().count(), 1); - delete loader; } void tst_QQuickLoader::failNetworkRequest() diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 99a53110a8..791fb71685 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -29,7 +29,9 @@ #include <QDebug> #include <QFile> #include <QFileInfo> +#if QT_CONFIG(commandlineparser) #include <QCommandLineParser> +#endif #include <QCoreApplication> #include <private/qv4value_p.h> @@ -73,6 +75,7 @@ int main(int argv, char *argc[]) QCoreApplication app(argv, argc); QCoreApplication::setApplicationName("qmllint"); QCoreApplication::setApplicationVersion("1.0"); +#if QT_CONFIG(commandlineparser) QCommandLineParser parser; parser.setApplicationDescription(QLatin1String("QML syntax verifier")); parser.addHelpOption(); @@ -89,8 +92,16 @@ int main(int argv, char *argc[]) } bool silent = parser.isSet(silentOption); +#else + bool silent = false; +#endif bool success = true; +#if QT_CONFIG(commandlineparser) for (const QString &filename : positionalArguments) +#else + const auto arguments = app.arguments(); + for (const QString &filename : arguments) +#endif success &= lint_file(filename, silent); return success ? 0 : -1; |