Merge remote-tracking branch 'origin/5.8' into dev

Conflicts:
	src/quick/util/qquickutilmodule.cpp
	tools/qmllint/main.cpp

Change-Id: Ic2283f88c293ca7fc776de3e83eb4c7812309d8a
This commit is contained in:
Liang Qi 2017-01-26 00:34:21 +01:00
commit 0076c44d39
20 changed files with 178 additions and 28 deletions

View File

@ -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 {

View File

@ -5,10 +5,10 @@ SUBDIRS += \
qtqml \
folderlistmodel \
localstorage \
models \
statemachine
models
qtConfig(settings): SUBDIRS += settings
qtConfig(statemachine): SUBDIRS += statemachine
qtHaveModule(quick) {
SUBDIRS += \

View File

@ -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);
}

View File

@ -73,7 +73,7 @@ struct QQmlProfiler {};
struct QQmlBindingProfiler
{
QQmlBindingProfiler(quintptr, QQmlBinding *, QV4::FunctionObject *) {}
QQmlBindingProfiler(quintptr, QV4::Function *) {}
};
struct QQmlHandlingSignalProfiler

View File

@ -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.

View File

@ -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();

View File

@ -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 {

View File

@ -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();

View File

@ -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;

View File

@ -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

View File

@ -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
}

View File

@ -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 \

View File

@ -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

View File

@ -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)

View File

@ -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
}
}

View File

@ -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;
}

View File

@ -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()
}
}
}

View File

@ -9,5 +9,6 @@ TESTDATA = data/*
OTHER_FILES += \
data/tst_rowlayout.qml \
data/tst_gridlayout.qml
data/tst_gridlayout.qml \
data/tst_stacklayout.qml

View File

@ -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()

View File

@ -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;