aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2016-01-22 15:20:47 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-01-22 15:21:06 +0100
commitf286db98ee41a8aa71b9a65a235b6d3e265d79f4 (patch)
tree16e17d4c52d35f7e55fc2103db5c96850e9bdfff
parentce093497f2d4164fa8abc06cf976f9e36798e11e (diff)
parentb60a5dc9405ce89d7a742abc81b906d5c8cf5f7d (diff)
Merge remote-tracking branch 'origin/5.6' into dev
-rw-r--r--examples/quick/imageprovider/doc/src/imageprovider.qdoc1
-rw-r--r--examples/quick/imageresponseprovider/doc/src/imageresponseprovider.qdoc2
-rw-r--r--src/imports/statemachine/plugin.cpp2
-rw-r--r--src/imports/statemachine/signaltransition.cpp68
-rw-r--r--src/imports/statemachine/signaltransition.h27
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h3
-rw-r--r--src/qml/parser/qqmljs.g19
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp22
-rw-r--r--src/qml/qml/qqmlboundsignal_p.h1
-rw-r--r--src/qml/qml/qqmlcomponent.cpp4
-rw-r--r--src/qml/qml/qqmlengine.cpp2
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp8
-rw-r--r--src/quick/items/qquickitem.cpp2
-rw-r--r--src/quick/items/qquickitemview.cpp4
-rw-r--r--src/quick/items/qquickitemview_p_p.h2
-rw-r--r--src/quick/items/qquicklistview.cpp4
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquicktext.cpp2
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode.cpp3
-rw-r--r--tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp1
-rw-r--r--tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml79
-rw-r--r--tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml80
-rw-r--r--tests/auto/quick/qquickitem2/data/qtbug_50516.qml9
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp22
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug50097.qml47
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp41
-rw-r--r--tests/auto/quick/qquickmousearea/data/qtbug49100.qml29
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp13
-rw-r--r--tools/qmlplugindump/main.cpp11
29 files changed, 480 insertions, 30 deletions
diff --git a/examples/quick/imageprovider/doc/src/imageprovider.qdoc b/examples/quick/imageprovider/doc/src/imageprovider.qdoc
index ba4817ca0f..f848e03fcd 100644
--- a/examples/quick/imageprovider/doc/src/imageprovider.qdoc
+++ b/examples/quick/imageprovider/doc/src/imageprovider.qdoc
@@ -27,6 +27,7 @@
/*!
\title C++ Extensions: Image Provider Example
+ \brief How to load images in QML with QQuickImageProvider.
\example imageprovider
This examples shows how to use QQuickImageProvider to serve images
diff --git a/examples/quick/imageresponseprovider/doc/src/imageresponseprovider.qdoc b/examples/quick/imageresponseprovider/doc/src/imageresponseprovider.qdoc
index afe1d406d8..a883ee1f2e 100644
--- a/examples/quick/imageresponseprovider/doc/src/imageresponseprovider.qdoc
+++ b/examples/quick/imageresponseprovider/doc/src/imageresponseprovider.qdoc
@@ -28,6 +28,8 @@
/*!
\title C++ Extensions: Image Response Provider Example
\example imageresponseprovider
+ \brief How to load images asynchronously in QML.
+
This examples shows how to use QQuickImageProvider to serve images
asynchronously to QML image elements.
diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp
index 2242ccf5e3..db79751b69 100644
--- a/src/imports/statemachine/plugin.cpp
+++ b/src/imports/statemachine/plugin.cpp
@@ -72,7 +72,7 @@ public:
qmlRegisterUncreatableType<QState>(uri, 1, 0, "QState", "Don't use this, use State instead");
qmlRegisterUncreatableType<QAbstractState>(uri, 1, 0, "QAbstractState", "Don't use this, use State instead");
qmlRegisterUncreatableType<QSignalTransition>(uri, 1, 0, "QSignalTransition", "Don't use this, use SignalTransition instead");
- qmlRegisterType<SignalTransition>(uri, 1, 0, "SignalTransition");
+ qmlRegisterCustomType<SignalTransition>(uri, 1, 0, "SignalTransition", new SignalTransitionParser);
qmlRegisterType<TimeoutTransition>(uri, 1, 0, "TimeoutTransition");
qmlProtectModule(uri, 1);
}
diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp
index 7eee8af3bc..47efc9ec15 100644
--- a/src/imports/statemachine/signaltransition.cpp
+++ b/src/imports/statemachine/signaltransition.cpp
@@ -51,9 +51,10 @@
#include <private/qjsvalue_p.h>
#include <private/qv4scopedvalue_p.h>
#include <private/qqmlcontext_p.h>
+#include <private/qqmlboundsignal_p.h>
SignalTransition::SignalTransition(QState *parent)
- : QSignalTransition(this, SIGNAL(invokeYourself()), parent)
+ : QSignalTransition(this, SIGNAL(invokeYourself()), parent), m_complete(false), m_signalExpression(Q_NULLPTR)
{
connect(this, SIGNAL(signalChanged()), SIGNAL(qmlSignalChanged()));
}
@@ -86,6 +87,15 @@ bool SignalTransition::eventTest(QEvent *event)
return result.toBool();
}
+void SignalTransition::onTransition(QEvent *event)
+{
+ if (m_signalExpression) {
+ QStateMachine::SignalEvent *e = static_cast<QStateMachine::SignalEvent*>(event);
+ m_signalExpression->evaluate(e->arguments());
+ }
+ QSignalTransition::onTransition(event);
+}
+
const QJSValue& SignalTransition::signal()
{
return m_signal;
@@ -110,6 +120,8 @@ void SignalTransition::setSignal(const QJSValue &signal)
QSignalTransition::setSenderObject(sender);
QSignalTransition::setSignal(metaMethod.methodSignature());
+
+ connectTriggered();
}
QQmlScriptString SignalTransition::guard() const
@@ -131,6 +143,60 @@ void SignalTransition::invoke()
emit invokeYourself();
}
+void SignalTransition::connectTriggered()
+{
+ if (!m_complete || !m_cdata)
+ return;
+
+ QObject *target = senderObject();
+ QQmlData *ddata = QQmlData::get(this);
+ QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0;
+
+ Q_ASSERT(m_bindings.count() == 1);
+ const QV4::CompiledData::Binding *binding = m_bindings.at(0);
+ Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Script);
+
+ QV4::ExecutionEngine *jsEngine = QV8Engine::getV4(QQmlEngine::contextForObject(this)->engine());
+ QV4::Scope scope(jsEngine);
+ QV4::Scoped<QV4::QObjectMethod> qobjectSignal(scope, QJSValuePrivate::convertedToValue(jsEngine, m_signal));
+ Q_ASSERT(qobjectSignal);
+ QMetaMethod metaMethod = target->metaObject()->method(qobjectSignal->methodIndex());
+ int signalIndex = QMetaObjectPrivate::signalIndex(metaMethod);
+
+ QQmlBoundSignalExpression *expression = ctxtdata ?
+ new QQmlBoundSignalExpression(target, signalIndex,
+ ctxtdata, this, m_cdata->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : 0;
+ if (expression)
+ expression->setNotifyOnValueChanged(false);
+ m_signalExpression = expression;
+}
+
+void SignalTransitionParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)
+{
+ for (int ii = 0; ii < props.count(); ++ii) {
+ const QV4::CompiledData::Binding *binding = props.at(ii);
+
+ QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
+
+ if (propName != QStringLiteral("onTriggered")) {
+ error(props.at(ii), SignalTransition::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
+ return;
+ }
+
+ if (binding->type != QV4::CompiledData::Binding::Type_Script) {
+ error(binding, SignalTransition::tr("SignalTransition: script expected"));
+ return;
+ }
+ }
+}
+
+void SignalTransitionParser::applyBindings(QObject *object, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings)
+{
+ SignalTransition *st = qobject_cast<SignalTransition*>(object);
+ st->m_cdata = cdata;
+ st->m_bindings = bindings;
+}
+
/*!
\qmltype QAbstractTransition
\inqmlmodule QtQml.StateMachine
diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h
index e8e064a995..3471aea0c8 100644
--- a/src/imports/statemachine/signaltransition.h
+++ b/src/imports/statemachine/signaltransition.h
@@ -45,12 +45,17 @@
#include <QtQml/QJSValue>
#include <QtQml/qqmlscriptstring.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <private/qqmlcustomparser_p.h>
+#include <private/qqmlboundsignalexpressionpointer_p.h>
+#include <private/qqmlcompiler_p.h>
QT_BEGIN_NAMESPACE
-class SignalTransition : public QSignalTransition
+class SignalTransition : public QSignalTransition, public QQmlParserStatus
{
Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QJSValue signal READ signal WRITE setSignal NOTIFY qmlSignalChanged)
Q_PROPERTY(QQmlScriptString guard READ guard WRITE setGuard NOTIFY guardChanged)
@@ -60,7 +65,8 @@ public:
QQmlScriptString guard() const;
void setGuard(const QQmlScriptString &guard);
- bool eventTest(QEvent *event);
+ bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ void onTransition(QEvent *event) Q_DECL_OVERRIDE;
const QJSValue &signal();
void setSignal(const QJSValue &signal);
@@ -76,9 +82,24 @@ Q_SIGNALS:
void qmlSignalChanged();
private:
- QByteArray m_data;
+ void classBegin() Q_DECL_OVERRIDE { m_complete = false; }
+ void componentComplete() Q_DECL_OVERRIDE { m_complete = true; connectTriggered(); }
+ void connectTriggered();
+
+ friend class SignalTransitionParser;
QJSValue m_signal;
QQmlScriptString m_guard;
+ bool m_complete;
+ QQmlRefPointer<QQmlCompiledData> m_cdata;
+ QList<const QV4::CompiledData::Binding *> m_bindings;
+ QQmlBoundSignalExpressionPointer m_signalExpression;
+};
+
+class SignalTransitionParser : public QQmlCustomParser
+{
+public:
+ void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props) Q_DECL_OVERRIDE;
+ void applyBindings(QObject *object, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
index aea03d2257..6e6bf8ff68 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
@@ -46,6 +46,9 @@
#include <QtCore/QJsonObject>
#include <QtCore/QJsonArray>
+#include <QtCore/QJsonObject>
+#include <QtCore/QJsonArray>
+
QT_BEGIN_NAMESPACE
class QV4Debugger;
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index 1a7028dbb3..161c8ffcde 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -467,7 +467,24 @@ bool Parser::parse(int startToken)
token_buffer[0].token = startToken;
first_token = &token_buffer[0];
- last_token = &token_buffer[1];
+ if (startToken == T_FEED_JS_PROGRAM && !lexer->qmlMode()) {
+ Directives ignoreDirectives;
+ Directives *directives = driver->directives();
+ if (!directives)
+ directives = &ignoreDirectives;
+ DiagnosticMessage error;
+ if (!lexer->scanDirectives(directives, &error)) {
+ diagnostic_messages.append(error);
+ return false;
+ }
+ token_buffer[1].token = lexer->tokenKind();
+ token_buffer[1].dval = lexer->tokenValue();
+ token_buffer[1].loc = location(lexer);
+ token_buffer[1].spell = lexer->tokenSpell();
+ last_token = &token_buffer[2];
+ } else {
+ last_token = &token_buffer[1];
+ }
tos = -1;
program = 0;
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index f2acc7352c..9879763c72 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -245,6 +245,28 @@ void QQmlBoundSignalExpression::evaluate(void **a)
ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.
}
+void QQmlBoundSignalExpression::evaluate(const QList<QVariant> &args)
+{
+ Q_ASSERT (context() && engine());
+
+ if (!expressionFunctionValid())
+ return;
+
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine());
+ QV4::Scope scope(ep->v4engine());
+
+ ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation.
+
+ QV4::ScopedCallData callData(scope, args.count());
+ for (int ii = 0; ii < args.count(); ++ii) {
+ callData->args[ii] = scope.engine->fromVariant(args[ii]);
+ }
+
+ QQmlJavaScriptExpression::evaluate(callData, 0);
+
+ ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.
+}
+
////////////////////////////////////////////////////////////////////////
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h
index 59ed37c939..10c59b07c1 100644
--- a/src/qml/qml/qqmlboundsignal_p.h
+++ b/src/qml/qml/qqmlboundsignal_p.h
@@ -84,6 +84,7 @@ public:
// evaluation of a bound signal expression doesn't return any value
void evaluate(void **a);
+ void evaluate(const QList<QVariant> &args);
QQmlSourceLocation sourceLocation() const;
QString expression() const;
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 3337838a90..b8bd0f7f1d 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -295,7 +295,7 @@ V4_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
\value Null This QQmlComponent has no data. Call loadUrl() or setData() to add QML content.
\value Ready This QQmlComponent is ready and create() may be called.
\value Loading This QQmlComponent is loading network data.
- \value Error An error has occurred. Call errors() to retrieve a list of \{QQmlError}{errors}.
+ \value Error An error has occurred. Call errors() to retrieve a list of \l {QQmlError}{errors}.
*/
/*!
@@ -685,7 +685,7 @@ void QQmlComponentPrivate::loadUrl(const QUrl &newUrl, QQmlComponent::Compilatio
}
/*!
- Return the list of errors that occurred during the last compile or create
+ Returns the list of errors that occurred during the last compile or create
operation. An empty list is returned if isError() is not set.
*/
QList<QQmlError> QQmlComponent::errors() const
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 74a3129dfb..0e99e4ca89 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1240,7 +1240,7 @@ bool QQmlEngine::outputWarningsToStandardError() const
If \a enabled is true, any warning messages generated by QML will be
output to stderr and emitted by the warnings() signal. If \a enabled
- is false, on the warnings() signal will be emitted. This allows
+ is false, only the warnings() signal will be emitted. This allows
applications to handle warning output themselves.
The default value is true.
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index fcb6c2da8f..68f465cc5a 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -228,6 +228,9 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
operations. The Canvas output may be saved as an image file or serialized
to a URL.
+ Rendering to the Canvas is done using a Context2D object, usually as a
+ result of the \l paint signal.
+
To define a drawing area in the Canvas item set the \c width and \c height
properties. For example, the following code creates a Canvas item which
has a drawing area with a height of 100 pixels and width of 200 pixels:
@@ -237,6 +240,11 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
id: mycanvas
width: 100
height: 200
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.fillStyle = Qt.rgba(1, 0, 0, 1);
+ ctx.fillRect(0, 0, width, height);
+ }
}
\endqml
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 2bfb16a0f4..dec2351de8 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2514,6 +2514,8 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo
lastChild = prevTabChildItem(current, -1);
}
bool isTabFence = current->d_func()->isTabFence;
+ if (isTabFence && !hasChildren)
+ return current;
// coming from parent: check children
if (hasChildren && from == current->parentItem()) {
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 1d581d769f..7009a8e328 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -957,7 +957,7 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
switch (mode) {
case QQuickItemView::Beginning:
pos = itemPos;
- if (index < 0 && header)
+ if (header && (index < 0 || hasStickyHeader()))
pos -= headerSize();
break;
case QQuickItemView::Center:
@@ -965,7 +965,7 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
break;
case QQuickItemView::End:
pos = itemPos - size() + item->size();
- if (index >= model->count() && footer)
+ if (footer && (index >= model->count() || hasStickyFooter()))
pos += footerSize();
break;
case QQuickItemView::Visible:
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index 220df577c3..5e104cf208 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -344,6 +344,8 @@ protected:
virtual bool showFooterForIndex(int index) const = 0;
virtual void updateHeader() = 0;
virtual void updateFooter() = 0;
+ virtual bool hasStickyHeader() const { return false; };
+ virtual bool hasStickyFooter() const { return false; };
virtual void createHighlight() = 0;
virtual void updateHighlight() = 0;
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 0aee8f2067..e42873f459 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -123,8 +123,8 @@ public:
bool showFooterForIndex(int index) const Q_DECL_OVERRIDE;
void updateHeader() Q_DECL_OVERRIDE;
void updateFooter() Q_DECL_OVERRIDE;
- bool hasStickyHeader() const;
- bool hasStickyFooter() const;
+ bool hasStickyHeader() const Q_DECL_OVERRIDE;
+ bool hasStickyFooter() const Q_DECL_OVERRIDE;
void changedVisibleIndex(int newIndex) Q_DECL_OVERRIDE;
void initializeCurrentItem() Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index dc41a4739b..42de98eff7 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -124,7 +124,7 @@ bool QQuickMouseAreaPrivate::isWheelConnected()
void QQuickMouseAreaPrivate::propagate(QQuickMouseEvent* event, PropagateType t)
{
Q_Q(QQuickMouseArea);
- if (!propagateComposedEvents)
+ if (!window || !propagateComposedEvents)
return;
QPointF scenePos = q->mapToScene(QPointF(event->x(), event->y()));
propagateHelper(event, window->contentItem(), scenePos, t);
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index aa9c8d21eb..97e00362be 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -471,7 +471,7 @@ void QQuickTextPrivate::updateSize()
}
QQuickTextLine::QQuickTextLine()
- : QObject(), m_line(0), m_height(0)
+ : QObject(), m_line(0), m_height(0), m_lineOffset(0)
{
}
diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp
index f1d41fcc69..c26092e20c 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp
@@ -293,7 +293,8 @@ void QSGDefaultImageNode::preprocess()
QSGDynamicTexture *t = qobject_cast<QSGDynamicTexture *>(m_material.texture());
if (t) {
doDirty = t->updateTexture();
- updateGeometry();
+ if (doDirty)
+ updateGeometry();
}
bool alpha = m_material.flags() & QSGMaterial::Blending;
if (m_material.texture() && alpha != m_material.texture()->hasAlphaChannel()) {
diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
index 8bf1feea7e..ee417bb480 100644
--- a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
+++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
@@ -109,6 +109,7 @@ void tst_qmlplugindump::singleton()
const QString &result = dumper.readAllStandardOutput();
QVERIFY(result.contains(QLatin1String("exports: [\"Singleton 1.0\"]")));
+ QVERIFY(result.contains(QLatin1String("exportMetaObjectRevisions: [0]")));
}
QTEST_MAIN(tst_qmlplugindump)
diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml
new file mode 100644
index 0000000000..5d2e867da4
--- /dev/null
+++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Ford Motor Company
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtTest 1.1
+import QtQml.StateMachine 1.0
+
+TestCase {
+ id: testCase
+
+ property string mystr
+ property bool mybool
+ property int myint
+
+ StateMachine {
+ id: machine
+ initialState: startState
+ running: true
+ State {
+ id: startState
+ SignalTransition {
+ id: signalTrans
+ signal: testCase.mysignal
+ onTriggered: {
+ testCase.mystr = mystr
+ testCase.mybool = mybool
+ testCase.myint = myint
+ }
+ targetState: finalState
+ }
+ }
+ FinalState {
+ id: finalState
+ }
+ }
+
+ signal mysignal(string mystr, bool mybool, int myint)
+
+ name: "testTriggeredArguments1"
+ function test_triggeredArguments()
+ {
+ tryCompare(startState, "active", true)
+
+ // Emit the signalTrans.signal
+ testCase.mysignal("test1", true, 2)
+ compare(testCase.mystr, "test1")
+ compare(testCase.mybool, true)
+ compare(testCase.myint, 2)
+ }
+}
diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml
new file mode 100644
index 0000000000..f60f2ff78c
--- /dev/null
+++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Ford Motor Company
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtTest 1.1
+import QtQml.StateMachine 1.0
+
+TestCase {
+ id: testCase
+
+ property string mystr
+ property bool mybool
+ property int myint
+
+ StateMachine {
+ id: machine
+ initialState: startState
+ running: true
+ State {
+ id: startState
+ SignalTransition {
+ id: signalTrans
+ signal: testCase.mysignal
+ onTriggered: function(strarg, boolarg, intarg) {
+ testCase.mystr = strarg
+ testCase.mybool = boolarg
+ testCase.myint = intarg
+ }
+ targetState: finalState
+ }
+ }
+ FinalState {
+ id: finalState
+ }
+ }
+
+ signal mysignal(string mystr, bool mybool, int myint)
+
+ name: "testTriggeredArguments2"
+ function test_triggeredArguments()
+ {
+ tryCompare(startState, "active", true)
+
+ // Emit the signalTrans.signal
+ testCase.mysignal("test1", true, 2)
+ expectFail("", "QTBUG-50328")
+ compare(testCase.mystr, "test1")
+ compare(testCase.mybool, true)
+ compare(testCase.myint, 2)
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/qtbug_50516.qml b/tests/auto/quick/qquickitem2/data/qtbug_50516.qml
new file mode 100644
index 0000000000..5e2a60b26f
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/qtbug_50516.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.1
+import Test 1.0
+
+TabFence {
+ objectName: "root"
+ focus: true
+ width: 800
+ height: 600
+}
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index 34209ee610..607dbccaed 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -69,6 +69,7 @@ private slots:
void nextItemInFocusChain3();
void tabFence();
+ void qtbug_50516();
void keys();
void standardKeys_data();
@@ -1190,6 +1191,27 @@ void tst_QQuickItem::tabFence()
verifyTabFocusChain(window, fence1BacktabFocusChain, false /* forward */);
}
+void tst_QQuickItem::qtbug_50516()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("qtbug_50516.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+ QVERIFY(window->rootObject()->hasActiveFocus());
+
+ QQuickItem *contentItem = window->rootObject();
+ QQuickItem *next = contentItem->nextItemInFocusChain(true);
+ QCOMPARE(next, contentItem);
+ next = contentItem->nextItemInFocusChain(false);
+ QCOMPARE(next, contentItem);
+
+ delete window;
+}
+
void tst_QQuickItem::keys()
{
QQuickView *window = new QQuickView(0);
diff --git a/tests/auto/quick/qquicklistview/data/qtbug50097.qml b/tests/auto/quick/qquicklistview/data/qtbug50097.qml
new file mode 100644
index 0000000000..24d506b804
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug50097.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.6
+
+ListView {
+ id: lv
+
+ // How many rows per page
+ property int pageSize: 5
+
+ // The current page number
+ property int currentPage: 1
+
+ // How large a single item is
+ property int itemSize: 100
+
+ // Arbitrary
+ property int totalPages: 5
+
+ height: itemSize * pageSize // display one full page at a time
+ width: 500 // arbitrary.
+ model: pageSize * totalPages
+ delegate: Text {
+ height: itemSize
+ text: "Item " + (index + 1) + " of " + lv.count
+ }
+
+ // contentY should be < 0 to account for header visibility
+ onContentYChanged: console.log(contentY)
+
+ headerPositioning: ListView.OverlayHeader
+ header: Rectangle {
+ height: itemSize
+ width: 500
+ z: 1000
+ visible: false
+ color: "black"
+
+ Text {
+ anchors.centerIn: parent
+ color: "red"
+ text: "List header"
+ }
+ }
+
+ onCurrentPageChanged: {
+ lv.positionViewAtIndex((currentPage - 1) * pageSize, ListView.Beginning);
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 8f0e1a3651..1e3d1d95b3 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -249,6 +249,7 @@ private slots:
void QTBUG_50105();
void keyNavigationEnabled();
+ void QTBUG_50097_stickyHeader_positionViewAtIndex();
private:
template <class T> void items(const QUrl &source);
@@ -7476,7 +7477,7 @@ void tst_QQuickListView::stickyPositioning()
QFETCH(QPointF, headerPos);
QFETCH(QPointF, footerPos);
- QQuickView *window = createView();
+ QQuickView *window = getView();
QaimModel model;
for (int i = 0; i < 20; i++)
@@ -7519,7 +7520,7 @@ void tst_QQuickListView::stickyPositioning()
QCOMPARE(actualPos, footerPos);
}
- delete window;
+ releaseView(window);
}
void tst_QQuickListView::stickyPositioning_data()
@@ -7546,7 +7547,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("top header") << "stickyPositioning-header.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom
<< 0 << QQuickItemView::Beginning << QList<QPointF>()
- << QPointF(0,-10) << QPointF();
+ << QPointF(0,0) << QPointF();
QTest::newRow("top header: 1/2 up") << "stickyPositioning-header.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom
@@ -7573,7 +7574,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("top footer") << "stickyPositioning-footer.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop
<< 19 << QQuickItemView::End << QList<QPointF>()
- << QPointF() << QPointF(0,-10);
+ << QPointF() << QPointF(0,0);
QTest::newRow("top footer: 1/2 up") << "stickyPositioning-footer.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop
@@ -7600,7 +7601,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("bottom header") << "stickyPositioning-header.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop
<< 0 << QQuickItemView::Beginning << QList<QPointF>()
- << QPointF(0,100) << QPointF();
+ << QPointF(0,90) << QPointF();
QTest::newRow("bottom header: 1/2 down") << "stickyPositioning-header.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop
@@ -7627,7 +7628,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("bottom footer") << "stickyPositioning-footer.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom
<< 19 << QQuickItemView::End << QList<QPointF>()
- << QPointF() << QPointF(0,100);
+ << QPointF() << QPointF(0,90);
QTest::newRow("bottom footer: 1/2 down") << "stickyPositioning-footer.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom
@@ -7654,7 +7655,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("top header & bottom footer") << "stickyPositioning-both.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom
<< 0 << QQuickItemView::Beginning << QList<QPointF>()
- << QPointF(0,-10) << QPointF(0,90);
+ << QPointF(0,0) << QPointF(0,100);
QTest::newRow("top header & bottom footer: 1/2 up") << "stickyPositioning-both.qml"
<< Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom
@@ -7707,7 +7708,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("left header") << "stickyPositioning-header.qml"
<< Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom
<< 0 << QQuickItemView::Beginning << QList<QPointF>()
- << QPointF(-10,0) << QPointF();
+ << QPointF(0,0) << QPointF();
QTest::newRow("left header: 1/2 left") << "stickyPositioning-header.qml"
<< Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom
@@ -7734,7 +7735,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("left footer") << "stickyPositioning-footer.qml"
<< Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom
<< 19 << QQuickItemView::End << QList<QPointF>()
- << QPointF() << QPointF(-10,0);
+ << QPointF() << QPointF(0,0);
QTest::newRow("left footer: 1/2 left") << "stickyPositioning-footer.qml"
<< Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom
@@ -7761,7 +7762,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("right header") << "stickyPositioning-header.qml"
<< Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom
<< 0 << QQuickItemView::Beginning << QList<QPointF>()
- << QPointF(100,0) << QPointF();
+ << QPointF(90,0) << QPointF();
QTest::newRow("right header: 1/2 right") << "stickyPositioning-header.qml"
<< Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom
@@ -7788,7 +7789,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("right footer") << "stickyPositioning-footer.qml"
<< Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom
<< 19 << QQuickItemView::End << QList<QPointF>()
- << QPointF() << QPointF(100,0);
+ << QPointF() << QPointF(90,0);
QTest::newRow("right footer: 1/2 right") << "stickyPositioning-footer.qml"
<< Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom
@@ -7815,7 +7816,7 @@ void tst_QQuickListView::stickyPositioning_data()
QTest::newRow("left header & right footer") << "stickyPositioning-both.qml"
<< Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom
<< 0 << QQuickItemView::Beginning << QList<QPointF>()
- << QPointF(-10,0) << QPointF(90,0);
+ << QPointF(0,0) << QPointF(100,0);
QTest::newRow("left header & right footer: 1/2 left") << "stickyPositioning-both.qml"
<< Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom
@@ -8513,6 +8514,22 @@ void tst_QQuickListView::QTBUG_50105()
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
}
+void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("qtbug50097.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QVERIFY(listview != 0);
+ QTRY_COMPARE(listview->contentY(), -100.0); // the header size, since the header is overlaid
+ listview->setProperty("currentPage", 2);
+ QTRY_COMPARE(listview->contentY(), 400.0); // a full page of items down, sans the original negative header position
+ listview->setProperty("currentPage", 1);
+ QTRY_COMPARE(listview->contentY(), -100.0); // back to the same position: header visible, items not under the header.
+}
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"
diff --git a/tests/auto/quick/qquickmousearea/data/qtbug49100.qml b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml
new file mode 100644
index 0000000000..39b293c8fa
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.2
+
+ListView {
+ id: list
+ width: 200
+ height: 200
+ model: 50
+ delegate: Text {
+ text: index + 1
+ height: 30
+ width: parent.width
+ MouseArea {
+ anchors.fill: parent
+ }
+ Rectangle {
+ anchors.fill: parent
+ opacity: 0.5
+ MouseArea {
+ anchors.fill: parent
+ propagateComposedEvents: true
+ onReleased: {
+ list.currentIndex = 0;
+ list.positionViewAtIndex(list.currentIndex, ListView.Contain)
+ }
+ }
+ }
+ }
+ Component.onCompleted: list.positionViewAtIndex(40, ListView.Beginning)
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index d97d43abfc..d2994ca0b4 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -1144,6 +1144,19 @@ void tst_QQuickMouseArea::clickThrough()
QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 2);
QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //disabled, shouldn't increment
+
+ window.reset(new QQuickView);
+
+ //QTBUG-49100
+ QVERIFY2(initView(*window.data(), testFileUrl("qtbug49100.qml"), true, &errorMessage), errorMessage.constData());
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100));
+
+ QVERIFY(window->rootObject() != 0);
}
void tst_QQuickMouseArea::hoverPosition()
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index de6e2f9b4d..776e19fdf4 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -786,12 +786,19 @@ static bool readDependenciesData(QString dependenciesFile, const QByteArray &fil
<< ": expected an array" << std::endl;
return false;
}
+ // Workaround for avoiding conflicting types when no dependency has been found.
+ //
+ // qmlplugindump used to import QtQuick, so all types defined in QtQuick used to be skipped when dumping.
+ // Now that it imports only Qt, it is no longer the case: if no dependency is found all the types defined
+ // in QtQuick will be dumped, causing conflicts.
+ if (dependencies->isEmpty())
+ dependencies->push_back(QLatin1String("QtQuick 2.0"));
return true;
}
-static bool readDependenciesFile(QString dependenciesFile, QStringList *dependencies,
+static bool readDependenciesFile(const QString &dependenciesFile, QStringList *dependencies,
const QStringList &urisToSkip) {
- if (!QFileInfo(dependenciesFile).exists()) {
+ if (!QFileInfo::exists(dependenciesFile)) {
std::cerr << "non existing dependencies file " << dependenciesFile.toStdString()
<< std::endl;
return false;