aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.9.01
-rw-r--r--examples/quick/demos/samegame/samegame.pro2
-rw-r--r--src/imports/builtins/builtins.qmltypes3
-rw-r--r--src/imports/qtquick2/plugins.qmltypes2
-rw-r--r--src/imports/settings/qqmlsettings.cpp18
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp5
-rw-r--r--src/qml/compiler/qqmlpropertyvalidator_p.h4
-rw-r--r--src/qml/configure.json9
-rw-r--r--src/qml/jsruntime/qv4alloca_p.h2
-rw-r--r--src/qml/jsruntime/qv4string_p.h4
-rw-r--r--src/qml/qtqmlglobal.h16
-rw-r--r--src/qml/qtqmlglobal_p.h4
-rw-r--r--src/quick/configure.json41
-rw-r--r--src/quick/items/qquickevents_p_p.h7
-rw-r--r--src/quick/items/qquickitem.cpp91
-rw-r--r--src/quick/items/qquickview.cpp1
-rw-r--r--src/quick/items/qquickwindow.cpp8
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp8
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp77
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h6
-rw-r--r--src/quickwidgets/qquickwidget.cpp5
-rwxr-xr-xtests/auto/qml/ecmascripttests/test262.py1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp11
-rw-r--r--tests/auto/qml/qqmlsettings/data/aliases.qml4
-rw-r--r--tests/auto/qml/qqmlsettings/data/cpp-aliases.qml2
-rw-r--r--tests/auto/qml/qqmlsettings/data/types.qml6
-rw-r--r--tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp206
-rw-r--r--tests/auto/quick/qquickview/data/findChild.qml9
-rw-r--r--tests/auto/quick/qquickview/tst_qquickview.cpp40
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp25
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp33
-rw-r--r--tools/qmlcachegen/qmlcache.prf5
35 files changed, 393 insertions, 286 deletions
diff --git a/dist/changes-5.9.0 b/dist/changes-5.9.0
index f6c6aebea9..7cd655e384 100644
--- a/dist/changes-5.9.0
+++ b/dist/changes-5.9.0
@@ -43,6 +43,7 @@ QtQml
to allow getting the actual storage path for a particular database.
- [QTBUG-53091] Introduced Qt.application.displayName, to map the
QGuiApplication::applicationDisplayName property to QML.
+ - [QTBUG-45316] QML Settings has been fixed to handle JavaScript arrays.
QtQuick
-------
diff --git a/examples/quick/demos/samegame/samegame.pro b/examples/quick/demos/samegame/samegame.pro
index 0f01654d46..7b680490ad 100644
--- a/examples/quick/demos/samegame/samegame.pro
+++ b/examples/quick/demos/samegame/samegame.pro
@@ -6,5 +6,3 @@ RESOURCES += samegame.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/samegame
INSTALLS += target
-
-!qtConfig(sql-sqlite): QTPLUGIN += qsqlite
diff --git a/src/imports/builtins/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes
index ac95a8837b..c2f8f5b521 100644
--- a/src/imports/builtins/builtins.qmltypes
+++ b/src/imports/builtins/builtins.qmltypes
@@ -426,7 +426,8 @@ Module {
"WA_X11DoNotAcceptFocus": 126,
"WA_MacNoShadow": 127,
"WA_AlwaysStackOnTop": 128,
- "WA_AttributeCount": 129
+ "WA_TabletTracking": 129,
+ "WA_AttributeCount": 130
}
}
Enum {
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes
index a9534b5ccc..834b4bfac2 100644
--- a/src/imports/qtquick2/plugins.qmltypes
+++ b/src/imports/qtquick2/plugins.qmltypes
@@ -1414,7 +1414,7 @@ Module {
Property { name: "source"; type: "QObject"; isPointer: true }
Property { name: "target"; type: "QObject"; isReadonly: true; isPointer: true }
Property { name: "hotSpot"; type: "QPointF" }
- Property { name: "imageSource"; revision: 8; type: "QUrl" }
+ Property { name: "imageSource"; type: "QUrl" }
Property { name: "keys"; type: "QStringList" }
Property { name: "mimeData"; type: "QVariantMap" }
Property { name: "supportedActions"; type: "Qt::DropActions" }
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index cd6fcbc718..df67c04654 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -41,6 +41,7 @@
#include <qcoreevent.h>
#include <qsettings.h>
#include <qpointer.h>
+#include <qjsvalue.h>
#include <qdebug.h>
#include <qhash.h>
@@ -241,6 +242,7 @@ public:
void store();
void _q_propertyChanged();
+ QVariant readProperty(const QMetaProperty &property) const;
QQmlSettings *q_ptr;
int timerId;
@@ -295,7 +297,7 @@ void QQmlSettingsPrivate::load()
for (int i = offset; i < count; ++i) {
QMetaProperty property = mo->property(i);
- const QVariant previousValue = property.read(q);
+ const QVariant previousValue = readProperty(property);
const QVariant currentValue = instance()->value(property.name(), previousValue);
if (!currentValue.isNull() && (!previousValue.isValid()
@@ -340,9 +342,10 @@ void QQmlSettingsPrivate::_q_propertyChanged()
const int count = mo->propertyCount();
for (int i = offset; i < count; ++i) {
const QMetaProperty &property = mo->property(i);
- changedProperties.insert(property.name(), property.read(q));
+ const QVariant value = readProperty(property);
+ changedProperties.insert(property.name(), value);
#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: cache" << property.name() << ":" << property.read(q);
+ qDebug() << "QQmlSettings: cache" << property.name() << ":" << value;
#endif
}
if (timerId != 0)
@@ -350,6 +353,15 @@ void QQmlSettingsPrivate::_q_propertyChanged()
timerId = q->startTimer(settingsWriteDelay);
}
+QVariant QQmlSettingsPrivate::readProperty(const QMetaProperty &property) const
+{
+ Q_Q(const QQmlSettings);
+ QVariant var = property.read(q);
+ if (var.userType() == qMetaTypeId<QJSValue>())
+ var = var.value<QJSValue>().toVariant();
+ return var;
+}
+
QQmlSettings::QQmlSettings(QObject *parent)
: QObject(parent), d_ptr(new QQmlSettingsPrivate)
{
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index de04116a6b..f766f0e4c8 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1961,7 +1961,7 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
// with the correct QML context.
// Look for IDs first.
- for (const IdMapping &mapping : qAsConst(_idObjects))
+ for (const IdMapping &mapping : qAsConst(_idObjects)) {
if (name == mapping.name) {
if (_function->isQmlBinding)
_function->idObjectDependencies.insert(mapping.idIndex);
@@ -1979,8 +1979,9 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
result->isReadOnly = true; // don't allow use as lvalue
return result;
}
+ }
- {
+ if (name.at(0).isUpper()) {
QQmlTypeNameCache::Result r = imports->query(name);
if (r.isValid()) {
if (r.scriptIndex != -1) {
diff --git a/src/qml/compiler/qqmlpropertyvalidator_p.h b/src/qml/compiler/qqmlpropertyvalidator_p.h
index d0bd314461..e37b8141f4 100644
--- a/src/qml/compiler/qqmlpropertyvalidator_p.h
+++ b/src/qml/compiler/qqmlpropertyvalidator_p.h
@@ -69,8 +69,8 @@ private:
bool canCoerce(int to, QQmlPropertyCache *fromMo) const;
- QVector<QQmlCompileError> recordError(const QV4::CompiledData::Location &location, const QString &description) const Q_REQUIRED_RESULT;
- QVector<QQmlCompileError> recordError(const QQmlCompileError &error) const Q_REQUIRED_RESULT;
+ Q_REQUIRED_RESULT QVector<QQmlCompileError> recordError(const QV4::CompiledData::Location &location, const QString &description) const;
+ Q_REQUIRED_RESULT QVector<QQmlCompileError> recordError(const QQmlCompileError &error) const;
QString stringAt(int index) const { return qmlUnit->stringAt(index); }
QQmlEnginePrivate *enginePrivate;
diff --git a/src/qml/configure.json b/src/qml/configure.json
index 2c4887365f..257bedecbc 100644
--- a/src/qml/configure.json
+++ b/src/qml/configure.json
@@ -15,17 +15,20 @@
"features": {
"qml-interpreter": {
"label": "QML interpreter",
- "purpose": "Support for the QML interpreter",
+ "purpose": "Provides the QML interpreter.",
+ "section": "QML",
"output": [ "privateFeature" ]
},
"qml-network": {
"label": "QML network support",
- "purpose": "Provides network transparency for QML",
+ "purpose": "Provides network transparency.",
+ "section": "QML",
"output": [ "publicFeature" ]
},
"qml-profiler": {
"label": "Command line QML Profiler",
- "purpose": "The QML Profiler retrieves QML tracing data from an application.",
+ "purpose": "Supports retrieving QML tracing data from an application.",
+ "section": "QML",
"condition": [
"features.commandlineparser",
"features.localserver",
diff --git a/src/qml/jsruntime/qv4alloca_p.h b/src/qml/jsruntime/qv4alloca_p.h
index c21878fa42..1e9f83a90e 100644
--- a/src/qml/jsruntime/qv4alloca_p.h
+++ b/src/qml/jsruntime/qv4alloca_p.h
@@ -58,7 +58,7 @@
#elif QT_CONFIG(alloca_malloc_h)
# include <malloc.h>
// This does not matter unless compiling in strict standard mode.
-# ifdef Q_OS_WIN
+# ifdef Q_CC_MSVC
# define alloca _alloca
# endif
#else
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index df0394d4cb..2f34dd6139 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -175,10 +175,6 @@ struct Q_QML_PRIVATE_EXPORT String : public Managed {
}
uint toUInt(bool *ok) const;
- Q_DECL_DEPRECATED void makeIdentifier(ExecutionEngine *) {
- makeIdentifier();
- }
-
void makeIdentifier() const {
if (d()->identifier)
return;
diff --git a/src/qml/qtqmlglobal.h b/src/qml/qtqmlglobal.h
index 6704e55b52..387c28a945 100644
--- a/src/qml/qtqmlglobal.h
+++ b/src/qml/qtqmlglobal.h
@@ -40,18 +40,20 @@
#ifndef QTQMLGLOBAL_H
#define QTQMLGLOBAL_H
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+# define QT_QML_BOOTSTRAPPED
+#endif
+
#include <QtCore/qglobal.h>
-#include <QtQml/qtqml-config.h>
-#if QT_CONFIG(qml_network)
-#include <QtNetwork/qtnetworkglobal.h>
+#ifndef QT_QML_BOOTSTRAPPED
+# include <QtQml/qtqml-config.h>
+# if QT_CONFIG(qml_network)
+# include <QtNetwork/qtnetworkglobal.h>
+# endif
#endif
QT_BEGIN_NAMESPACE
-#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
-# define QT_QML_BOOTSTRAPPED
-#endif
-
#if !defined(QT_QML_BOOTSTRAPPED) && !defined(QT_STATIC)
# if defined(QT_BUILD_QML_LIB)
# define Q_QML_EXPORT Q_DECL_EXPORT
diff --git a/src/qml/qtqmlglobal_p.h b/src/qml/qtqmlglobal_p.h
index 3314e73d19..4c0ba338d8 100644
--- a/src/qml/qtqmlglobal_p.h
+++ b/src/qml/qtqmlglobal_p.h
@@ -52,8 +52,10 @@
//
#include <QtCore/private/qglobal_p.h>
-#include <QtQml/private/qtqml-config_p.h>
#include <QtQml/qtqmlglobal.h>
+#ifndef QT_QML_BOOTSTRAPPED
+# include <QtQml/private/qtqml-config_p.h>
+#endif
#define Q_QML_PRIVATE_EXPORT Q_QML_EXPORT
diff --git a/src/quick/configure.json b/src/quick/configure.json
index 047fa8c948..65ad5b810b 100644
--- a/src/quick/configure.json
+++ b/src/quick/configure.json
@@ -34,7 +34,8 @@
"features": {
"d3d12": {
"label": "Direct3D 12",
- "purpose": "Provides a Direct3D 12 backend for the Qt Quick Scenegraph",
+ "purpose": "Provides a Direct3D 12 backend for the scenegraph.",
+ "section": "Qt Quick",
"condition": "tests.d3d12",
"output": [
"publicFeature"
@@ -42,7 +43,8 @@
},
"quick-animatedimage": {
"label": "AnimatedImage item",
- "purpose": "Provides the Qt Quick AnimatedImage Item",
+ "purpose": "Provides the AnimatedImage item.",
+ "section": "Qt Quick",
"condition": "features.movie",
"output": [
"privateFeature"
@@ -50,29 +52,33 @@
},
"quick-canvas": {
"label": "Canvas item",
- "purpose": "Provides the Qt Quick Canvas Item",
+ "purpose": "Provides the Canvas item.",
+ "section": "Qt Quick",
"condition": "features.quick-path",
"output": [
"privateFeature"
]
},
"quick-designer": {
- "label": "Support for Quick Designer",
- "purpose": "Provides support for the Qt Quick Designer in Qt Creator",
+ "label": "Support for Qt Quick Designer",
+ "purpose": "Provides support for the Qt Quick Designer in Qt Creator.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-flipable": {
"label": "Flipable item",
- "purpose": "Provides the Qt Quick Flipable Item",
+ "purpose": "Provides the Flipable item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-gridview": {
"label": "GridView item",
- "purpose": "Provides the Qt Quick GridView item",
+ "purpose": "Provides the GridView item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
@@ -93,14 +99,16 @@
},
"quick-listview": {
"label": "ListView item",
- "purpose": "Provides the Qt Quick ListView item",
+ "purpose": "Provides the ListView item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-particles": {
"label": "Particle support",
- "purpose": "Provides a particle system for Qt Quick",
+ "purpose": "Provides a particle system.",
+ "section": "Qt Quick",
"condition": "features.quick-shadereffect && features.quick-sprite && features.opengl",
"output": [
"privateFeature"
@@ -108,14 +116,16 @@
},
"quick-path": {
"label": "Path support",
- "purpose": "Provides Path elements in Qt Quick",
+ "purpose": "Provides Path elements.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-pathview": {
"label": "PathView item",
- "purpose": "Provides the Qt Quick PathView item",
+ "purpose": "Provides the PathView item.",
+ "section": "Qt Quick",
"condition": "features.quick-path",
"output": [
"privateFeature"
@@ -123,21 +133,24 @@
},
"quick-positioners": {
"label": "Positioner items",
- "purpose": "Provides Positioner items in Qt Quick",
+ "purpose": "Provides Positioner items.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-shadereffect": {
"label": "ShaderEffect item",
- "purpose": "Provides Shader effects in Qt Quick",
+ "purpose": "Provides Shader effects.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
},
"quick-sprite": {
"label": "Sprite item",
- "purpose": "Provides the Qt Quick Sprite Item",
+ "purpose": "Provides the Sprite item.",
+ "section": "Qt Quick",
"output": [
"privateFeature"
]
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 323ecfa4ff..3735d68a85 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -501,7 +501,6 @@ public:
: m_deviceType(devType), m_pointerType(pType), m_capabilities(caps)
, m_maximumTouchPoints(maxPoints), m_buttonCount(buttonCount), m_name(name)
, m_uniqueId(QPointingDeviceUniqueId::fromNumericId(uniqueId))
- , m_event(nullptr)
{
}
@@ -514,8 +513,6 @@ public:
QString name() const { return m_name; }
QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; }
- QQuickPointerEvent *pointerEvent() const { return m_event; } // deprecated
-
static QQuickPointerDevice *touchDevice(QTouchDevice *d);
static QList<QQuickPointerDevice *> touchDevices();
static QQuickPointerDevice *genericMouseDevice();
@@ -530,10 +527,6 @@ private:
QString m_name;
QPointingDeviceUniqueId m_uniqueId;
- // the event instance used last time within the context of one window
- QQuickPointerEvent *m_event; // deprecated
- friend class QQuickWindowPrivate; // not needed after removing the above
-
Q_DISABLE_COPY(QQuickPointerDevice)
};
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 4e52109582..a8a862bb2f 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -146,8 +146,8 @@ QQuickTransform::QQuickTransform(QQuickTransformPrivate &dd, QObject *parent)
QQuickTransform::~QQuickTransform()
{
Q_D(QQuickTransform);
- for (QQuickItem *item : qAsConst(d->items)) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ for (int ii = 0; ii < d->items.count(); ++ii) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->items.at(ii));
p->transforms.removeOne(this);
p->dirty(QQuickItemPrivate::Transform);
}
@@ -156,8 +156,8 @@ QQuickTransform::~QQuickTransform()
void QQuickTransform::update()
{
Q_D(QQuickTransform);
- for (QQuickItem *item : qAsConst(d->items)) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ for (int ii = 0; ii < d->items.count(); ++ii) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->items.at(ii));
p->dirty(QQuickItemPrivate::Transform);
}
}
@@ -169,7 +169,9 @@ QQuickContents::QQuickContents(QQuickItem *item)
QQuickContents::~QQuickContents()
{
- for (QQuickItem *child : m_item->childItems()) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
QQuickItemPrivate::get(child)->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
}
}
@@ -192,8 +194,9 @@ bool QQuickContents::calcHeight(QQuickItem *changed)
} else {
qreal top = std::numeric_limits<qreal>::max();
qreal bottom = -std::numeric_limits<qreal>::max();
- const QList<QQuickItem*> children = m_item->childItems();
- for (QQuickItem *child : qAsConst(children)) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
qreal y = child->y();
if (y + child->height() > bottom)
bottom = y + child->height();
@@ -226,8 +229,9 @@ bool QQuickContents::calcWidth(QQuickItem *changed)
} else {
qreal left = std::numeric_limits<qreal>::max();
qreal right = -std::numeric_limits<qreal>::max();
- const QList<QQuickItem*> children = m_item->childItems();
- for (QQuickItem *child : qAsConst(children)) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
qreal x = child->x();
if (x + child->width() > right)
right = x + child->width();
@@ -246,7 +250,9 @@ void QQuickContents::complete()
{
QQuickItemPrivate::get(m_item)->addItemChangeListener(this, QQuickItemPrivate::Children);
- for (QQuickItem *child : m_item->childItems()) {
+ QList<QQuickItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QQuickItem *child = children.at(i);
QQuickItemPrivate::get(child)->addItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
//###what about changes to visibility?
}
@@ -1347,7 +1353,8 @@ void QQuickKeysAttached::componentComplete()
#if QT_CONFIG(im)
Q_D(QQuickKeysAttached);
if (d->item) {
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *targetItem = d->targets.at(ii);
if (targetItem && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod)) {
d->item->setFlag(QQuickItem::ItemAcceptsInputMethod);
break;
@@ -1369,10 +1376,11 @@ void QQuickKeysAttached::keyPressed(QKeyEvent *event, bool post)
// first process forwards
if (d->item && d->item->window()) {
d->inPress = true;
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
- if (targetItem && targetItem->isVisible()) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *i = d->targets.at(ii);
+ if (i && i->isVisible()) {
event->accept();
- QCoreApplication::sendEvent(targetItem, event);
+ QCoreApplication::sendEvent(i, event);
if (event->isAccepted()) {
d->inPress = false;
return;
@@ -1412,10 +1420,11 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post)
if (d->item && d->item->window()) {
d->inRelease = true;
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
- if (targetItem && targetItem->isVisible()) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *i = d->targets.at(ii);
+ if (i && i->isVisible()) {
event->accept();
- QCoreApplication::sendEvent(targetItem, event);
+ QCoreApplication::sendEvent(i, event);
if (event->isAccepted()) {
d->inRelease = false;
return;
@@ -1439,7 +1448,8 @@ void QQuickKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool post)
Q_D(QQuickKeysAttached);
if (post == m_processPost && d->item && !d->inIM && d->item->window()) {
d->inIM = true;
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *targetItem = d->targets.at(ii);
if (targetItem && targetItem->isVisible() && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod)) {
QCoreApplication::sendEvent(targetItem, event);
if (event->isAccepted()) {
@@ -1458,12 +1468,13 @@ QVariant QQuickKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const
{
Q_D(const QQuickKeysAttached);
if (d->item) {
- for (QQuickItem *targetItem : qAsConst(d->targets)) {
- if (targetItem && targetItem->isVisible() && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod) && targetItem == d->imeItem) {
- //### how robust is targetItem == d->imeItem check?
- QVariant v = targetItem->inputMethodQuery(query);
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QQuickItem *i = d->targets.at(ii);
+ if (i && i->isVisible() && (i->flags() & QQuickItem::ItemAcceptsInputMethod) && i == d->imeItem) {
+ //### how robust is i == d->imeItem check?
+ QVariant v = i->inputMethodQuery(query);
if (v.userType() == QVariant::RectF)
- v = d->item->mapRectFromItem(targetItem, v.toRectF()); //### cost?
+ v = d->item->mapRectFromItem(i, v.toRectF()); //### cost?
return v;
}
}
@@ -1637,9 +1648,11 @@ void QQuickItemPrivate::setImplicitLayoutMirror(bool mirror, bool inherit)
if (isMirrorImplicit)
setLayoutMirror(inherit ? inheritedLayoutMirror : false);
- for (QQuickItem *child : qAsConst(childItems)) {
- QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
- childPrivate->setImplicitLayoutMirror(inheritedLayoutMirror, inheritMirrorFromParent);
+ for (int i = 0; i < childItems.count(); ++i) {
+ if (QQuickItem *child = qmlobject_cast<QQuickItem *>(childItems.at(i))) {
+ QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
+ childPrivate->setImplicitLayoutMirror(inheritedLayoutMirror, inheritMirrorFromParent);
+ }
}
}
@@ -2395,7 +2408,8 @@ QQuickItem::~QQuickItem()
remove themselves from our list of transforms when that list has already
been destroyed after ~QQuickItem() has run.
*/
- for (QQuickTransform *t : qAsConst(d->transforms)) {
+ for (int ii = 0; ii < d->transforms.count(); ++ii) {
+ QQuickTransform *t = d->transforms.at(ii);
QQuickTransformPrivate *tp = QQuickTransformPrivate::get(t);
tp->items.removeOne(this);
}
@@ -2886,8 +2900,8 @@ QList<QQuickItem *> QQuickItemPrivate::paintOrderChildItems() const
// If none of the items have set Z then the paint order list is the same as
// the childItems list. This is by far the most common case.
bool haveZ = false;
- for (QQuickItem *childItem : qAsConst(childItems)) {
- if (QQuickItemPrivate::get(childItem)->z() != 0.) {
+ for (int i = 0; i < childItems.count(); ++i) {
+ if (QQuickItemPrivate::get(childItems.at(i))->z() != 0.) {
haveZ = true;
break;
}
@@ -2988,7 +3002,8 @@ void QQuickItemPrivate::refWindow(QQuickWindow *c)
if (!parentItem)
QQuickWindowPrivate::get(window)->parentlessItems.insert(q);
- for (QQuickItem *child : qAsConst(childItems)) {
+ for (int ii = 0; ii < childItems.count(); ++ii) {
+ QQuickItem *child = childItems.at(ii);
QQuickItemPrivate::get(child)->refWindow(c);
}
@@ -3040,7 +3055,8 @@ void QQuickItemPrivate::derefWindow()
paintNode = 0;
- for (QQuickItem *child : qAsConst(childItems)) {
+ for (int ii = 0; ii < childItems.count(); ++ii) {
+ QQuickItem *child = childItems.at(ii);
QQuickItemPrivate::get(child)->derefWindow();
}
@@ -3485,7 +3501,8 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
- for (QQuickTransform *t : qAsConst(p->transforms)) {
+ for (int ii = 0; ii < p->transforms.count(); ++ii) {
+ QQuickTransform *t = p->transforms.at(ii);
QQuickTransformPrivate *tp = QQuickTransformPrivate::get(t);
tp->items.removeOne(that);
}
@@ -5850,9 +5867,8 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
}
bool childVisibilityChanged = false;
- for (QQuickItem *childItem : qAsConst(childItems)) {
- childVisibilityChanged |= QQuickItemPrivate::get(childItem)->setEffectiveVisibleRecur(newEffectiveVisible);
- }
+ for (int ii = 0; ii < childItems.count(); ++ii)
+ childVisibilityChanged |= QQuickItemPrivate::get(childItems.at(ii))->setEffectiveVisibleRecur(newEffectiveVisible);
itemChange(QQuickItem::ItemVisibleHasChanged, effectiveVisible);
#if QT_CONFIG(accessibility)
@@ -5901,8 +5917,8 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec
}
}
- for (QQuickItem *childItem : qAsConst(childItems)) {
- QQuickItemPrivate::get(childItem)->setEffectiveEnableRecur(
+ for (int ii = 0; ii < childItems.count(); ++ii) {
+ QQuickItemPrivate::get(childItems.at(ii))->setEffectiveEnableRecur(
(flags & QQuickItem::ItemIsFocusScope) && scope ? q : scope, newEffectiveEnable);
}
@@ -6343,6 +6359,7 @@ void QQuickItem::setFlags(Flags flags)
\qmlproperty real QtQuick::Item::height
Defines the item's position and size.
+ The default value is \c 0.
The (x,y) position is relative to the \l parent.
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 8313b53a7d..fca1805fc9 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -496,6 +496,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj)
if (QQuickItem *sgItem = qobject_cast<QQuickItem *>(obj)) {
root = sgItem;
sgItem->setParentItem(q->QQuickWindow::contentItem());
+ QQml_setParent_noEvent(sgItem, q->QQuickWindow::contentItem());
} else if (qobject_cast<QWindow *>(obj)) {
qWarning() << "QQuickView does not support using windows as a root item." << endl
<< endl
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index ea096bbe2e..2cb518d691 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -526,6 +526,7 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
Q_Q(QQuickWindow);
contentItem = new QQuickRootItem;
+ QQml_setParent_noEvent(contentItem, c);
QQmlEngine::setObjectOwnership(contentItem, QQmlEngine::CppOwnership);
QQuickItemPrivate *contentItemPrivate = QQuickItemPrivate::get(contentItem);
contentItemPrivate->window = q;
@@ -2117,10 +2118,8 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevic
{
// the list of devices should be very small so a linear search should be ok
for (QQuickPointerEvent *e: pointerEventInstances) {
- if (e->device() == device) {
- device->m_event = e;
+ if (e->device() == device)
return e;
- }
}
QQuickPointerEvent *ev = nullptr;
@@ -2138,7 +2137,6 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevic
break;
}
pointerEventInstances << ev;
- device->m_event = ev;
return ev;
}
@@ -3874,7 +3872,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const
QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateTextureOptions options) const
{
Q_D(const QQuickWindow);
- if (!isSceneGraphInitialized() || image.isNull()) // check both for d->context and d->context->isValid()
+ if (!isSceneGraphInitialized()) // check both for d->context and d->context->isValid()
return 0;
uint flags = 0;
if (options & TextureCanUseAtlas) flags |= QSGRenderContext::CreateTexture_Atlas;
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
index 2ff180ea99..02cf8209d1 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
@@ -165,12 +165,12 @@ QRegion QSGAbstractSoftwareRenderer::optimizeRenderList()
// Keep up with obscured regions
if (node->isOpaque()) {
- m_obscuredRegion += QRegion(node->boundingRect());
+ m_obscuredRegion += node->boundingRectMin();
}
if (node->isDirty()) {
// Don't paint things outside of the rendering area
- if (!m_background->rect().toRect().contains(node->boundingRect(), /*proper*/ true)) {
+ if (!m_background->rect().toRect().contains(node->boundingRectMax(), /*proper*/ true)) {
// Some part(s) of node is(are) outside of the rendering area
QRegion renderArea(m_background->rect().toRect());
QRegion outsideRegions = node->dirtyRegion().subtracted(renderArea);
@@ -181,7 +181,7 @@ QRegion QSGAbstractSoftwareRenderer::optimizeRenderList()
// Get the dirty region's to pass to the next nodes
if (node->isOpaque()) {
// if isOpaque, subtract node's dirty rect from m_dirtyRegion
- m_dirtyRegion -= node->dirtyRegion();
+ m_dirtyRegion -= node->boundingRectMin();
} else {
// if isAlpha, add node's dirty rect to m_dirtyRegion
m_dirtyRegion += node->dirtyRegion();
@@ -264,7 +264,7 @@ void QSGAbstractSoftwareRenderer::nodeRemoved(QSGNode *node)
// Need to mark this region dirty in the other nodes
QRegion dirtyRegion = renderable->previousDirtyRegion(true);
if (dirtyRegion.isEmpty())
- dirtyRegion = renderable->boundingRect();
+ dirtyRegion = renderable->boundingRectMax();
m_dirtyRegion += dirtyRegion;
m_nodes.remove(node);
delete renderable;
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
index 52984a4310..0f4a0ac8f5 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp
@@ -54,10 +54,28 @@
#include <private/qsgrendernode_p.h>
#include <private/qsgtexture_p.h>
+#include <qmath.h>
+
Q_LOGGING_CATEGORY(lcRenderable, "qt.scenegraph.softwarecontext.renderable")
QT_BEGIN_NAMESPACE
+// Largest subrectangle with integer coordinates
+inline QRect toRectMin(const QRectF & r)
+{
+ int x1 = qCeil(r.left());
+ int x2 = qFloor(r.right());
+ int y1 = qCeil(r.top());
+ int y2 = qFloor(r.bottom());
+ return QRect(x1, y1, x2 - x1, y2 - y1);
+}
+
+// Smallest superrectangle with integer coordinates
+inline QRect toRectMax(const QRectF & r)
+{
+ return r.toAlignedRect();
+}
+
QSGSoftwareRenderableNode::QSGSoftwareRenderableNode(NodeType type, QSGNode *node)
: m_nodeType(type)
, m_isOpaque(true)
@@ -117,7 +135,7 @@ void QSGSoftwareRenderableNode::update()
// Update the Node properties
m_isDirty = true;
- QRect boundingRect;
+ QRectF boundingRect;
switch (m_nodeType) {
case QSGSoftwareRenderableNode::SimpleRect:
@@ -126,7 +144,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleRectNode->rect().toRect();
+ boundingRect = m_handle.simpleRectNode->rect();
break;
case QSGSoftwareRenderableNode::SimpleTexture:
if (!m_handle.simpleTextureNode->texture()->hasAlphaChannel() && !m_transform.isRotating())
@@ -134,7 +152,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleTextureNode->rect().toRect();
+ boundingRect = m_handle.simpleTextureNode->rect();
break;
case QSGSoftwareRenderableNode::Image:
// There isn't a way to tell, so assume it's not
@@ -148,7 +166,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = QRect(0, 0, m_handle.painterNode->size().width(), m_handle.painterNode->size().height());
+ boundingRect = QRectF(0, 0, m_handle.painterNode->size().width(), m_handle.painterNode->size().height());
break;
case QSGSoftwareRenderableNode::Rectangle:
if (m_handle.rectangleNode->isOpaque() && !m_transform.isRotating())
@@ -156,19 +174,19 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.rectangleNode->rect().toRect();
+ boundingRect = m_handle.rectangleNode->rect();
break;
case QSGSoftwareRenderableNode::Glyph:
// Always has alpha
m_isOpaque = false;
- boundingRect = m_handle.glpyhNode->boundingRect().toAlignedRect();
+ boundingRect = m_handle.glpyhNode->boundingRect();
break;
case QSGSoftwareRenderableNode::NinePatch:
// Difficult to tell, assume non-opaque
m_isOpaque = false;
- boundingRect = m_handle.ninePatchNode->bounds().toRect();
+ boundingRect = m_handle.ninePatchNode->bounds();
break;
case QSGSoftwareRenderableNode::SimpleRectangle:
if (m_handle.simpleRectangleNode->color().alpha() == 255 && !m_transform.isRotating())
@@ -176,7 +194,7 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleRectangleNode->rect().toRect();
+ boundingRect = m_handle.simpleRectangleNode->rect();
break;
case QSGSoftwareRenderableNode::SimpleImage:
if (!m_handle.simpleImageNode->texture()->hasAlphaChannel() && !m_transform.isRotating())
@@ -184,12 +202,12 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.simpleImageNode->rect().toRect();
+ boundingRect = m_handle.simpleImageNode->rect();
break;
#if QT_CONFIG(quick_sprite)
case QSGSoftwareRenderableNode::SpriteNode:
m_isOpaque = m_handle.spriteNode->isOpaque();
- boundingRect = m_handle.spriteNode->rect().toRect();
+ boundingRect = m_handle.spriteNode->rect();
break;
#endif
case QSGSoftwareRenderableNode::RenderNode:
@@ -198,27 +216,32 @@ void QSGSoftwareRenderableNode::update()
else
m_isOpaque = false;
- boundingRect = m_handle.renderNode->rect().toRect();
+ boundingRect = m_handle.renderNode->rect();
break;
default:
break;
}
- m_boundingRect = m_transform.mapRect(boundingRect);
+ const QRectF transformedRect = m_transform.mapRect(boundingRect);
+ m_boundingRectMin = toRectMin(transformedRect);
+ m_boundingRectMax = toRectMax(transformedRect);
if (m_hasClipRegion && m_clipRegion.rectCount() <= 1) {
// If there is a clipRegion, and it is empty, the item wont be rendered
- if (m_clipRegion.isEmpty())
- m_boundingRect = QRect();
- else
- m_boundingRect = m_boundingRect.intersected(m_clipRegion.rects().first());
+ if (m_clipRegion.isEmpty()) {
+ m_boundingRectMin = QRect();
+ m_boundingRectMax = QRect();
+ } else {
+ m_boundingRectMin = m_boundingRectMin.intersected(m_clipRegion.rects().first());
+ m_boundingRectMax = m_boundingRectMax.intersected(m_clipRegion.rects().first());
+ }
}
// Overrides
if (m_opacity < 1.0f)
m_isOpaque = false;
- m_dirtyRegion = QRegion(m_boundingRect);
+ m_dirtyRegion = QRegion(m_boundingRectMax);
}
struct RenderNodeState : public QSGRenderNode::RenderState
@@ -258,7 +281,7 @@ QRegion QSGSoftwareRenderableNode::renderNode(QPainter *painter, bool forceOpaqu
rs.cr = m_clipRegion;
const QRect br = m_handle.renderNode->flags().testFlag(QSGRenderNode::BoundedRectRendering)
- ? m_boundingRect :
+ ? m_boundingRectMax :
QRect(0, 0, painter->device()->width(), painter->device()->height());
painter->save();
@@ -335,19 +358,13 @@ QRegion QSGSoftwareRenderableNode::renderNode(QPainter *painter, bool forceOpaqu
painter->restore();
QRegion areaToBeFlushed = m_dirtyRegion;
- m_previousDirtyRegion = QRegion(m_boundingRect);
+ m_previousDirtyRegion = QRegion(m_boundingRectMax);
m_isDirty = false;
m_dirtyRegion = QRegion();
return areaToBeFlushed;
}
-QRect QSGSoftwareRenderableNode::boundingRect() const
-{
- // This returns the bounding area of a renderable node in world coordinates
- return m_boundingRect;
-}
-
bool QSGSoftwareRenderableNode::isDirtyRegionEmpty() const
{
return m_dirtyRegion.isEmpty();
@@ -392,12 +409,12 @@ void QSGSoftwareRenderableNode::markMaterialDirty()
void QSGSoftwareRenderableNode::addDirtyRegion(const QRegion &dirtyRegion, bool forceDirty)
{
- // Check if the dirty region applys to this node
+ // Check if the dirty region applies to this node
QRegion prev = m_dirtyRegion;
- if (dirtyRegion.intersects(boundingRect())) {
+ if (dirtyRegion.intersects(m_boundingRectMax)) {
if (forceDirty)
m_isDirty = true;
- m_dirtyRegion += dirtyRegion.intersected(boundingRect());
+ m_dirtyRegion += dirtyRegion.intersected(m_boundingRectMax);
}
qCDebug(lcRenderable) << "addDirtyRegion: " << dirtyRegion << "old dirtyRegion: " << prev << "new dirtyRegion: " << m_dirtyRegion;
}
@@ -407,7 +424,7 @@ void QSGSoftwareRenderableNode::subtractDirtyRegion(const QRegion &dirtyRegion)
QRegion prev = m_dirtyRegion;
if (m_isDirty) {
// Check if this rect concerns us
- if (dirtyRegion.intersects(QRegion(boundingRect()))) {
+ if (dirtyRegion.intersects(m_boundingRectMax)) {
m_dirtyRegion -= dirtyRegion;
if (m_dirtyRegion.isEmpty())
m_isDirty = false;
@@ -423,7 +440,7 @@ QRegion QSGSoftwareRenderableNode::previousDirtyRegion(bool wasRemoved) const
if (wasRemoved)
return m_previousDirtyRegion;
- return m_previousDirtyRegion.subtracted(QRegion(m_boundingRect));
+ return m_previousDirtyRegion.subtracted(QRegion(m_boundingRectMax));
}
QRegion QSGSoftwareRenderableNode::dirtyRegion() const
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h
index 473578c185..8fc87db179 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h
@@ -98,7 +98,8 @@ public:
void update();
QRegion renderNode(QPainter *painter, bool forceOpaquePainting = false);
- QRect boundingRect() const;
+ QRect boundingRectMin() const { return m_boundingRectMin; }
+ QRect boundingRectMax() const { return m_boundingRectMax; }
NodeType type() const { return m_nodeType; }
bool isOpaque() const { return m_isOpaque; }
bool isDirty() const { return m_isDirty; }
@@ -149,7 +150,8 @@ private:
bool m_hasClipRegion;
float m_opacity;
- QRect m_boundingRect;
+ QRect m_boundingRectMin;
+ QRect m_boundingRectMax;
};
QT_END_NAMESPACE
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 4d021cb680..2e8623f508 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1440,6 +1440,9 @@ bool QQuickWidget::event(QEvent *e)
d->offscreenWindow->setWindowState(resolveWindowState(windowState()));
break;
+ case QEvent::ShortcutOverride:
+ return QCoreApplication::sendEvent(d->offscreenWindow, e);
+
default:
break;
}
@@ -1596,10 +1599,10 @@ QQuickWindow *QQuickWidget::quickWindow() const
void QQuickWidget::paintEvent(QPaintEvent *event)
{
- Q_UNUSED(event)
Q_D(QQuickWidget);
if (d->useSoftwareRenderer) {
QPainter painter(this);
+ d->updateRegion = d->updateRegion.united(event->region());
if (d->updateRegion.isNull()) {
//Paint everything
painter.drawImage(rect(), d->softwareImage);
diff --git a/tests/auto/qml/ecmascripttests/test262.py b/tests/auto/qml/ecmascripttests/test262.py
index 99f029cffd..9f0a7c1dee 100755
--- a/tests/auto/qml/ecmascripttests/test262.py
+++ b/tests/auto/qml/ecmascripttests/test262.py
@@ -569,6 +569,7 @@ def Main():
#logging.basicConfig(level=logging.DEBUG)
os.environ["TZ"] = "PST8PDT"
os.environ["LANG"] = "en_US.UTF-8"
+ os.environ["LC_TIME"] = "en_US.UTF-8"
parser = BuildOptions()
(options, args) = parser.parse_args()
ValidateOptions(options)
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml
new file mode 100644
index 0000000000..5f022f605a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import "components"
+
+QtObject {
+ id: root
+ property int counter
+ function increment() {
+ counter++
+ return counter
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml
new file mode 100644
index 0000000000..3c5e65a340
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+QtObject {}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml
new file mode 100644
index 0000000000..b09366e9df
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml
@@ -0,0 +1,8 @@
+import QtQml 2.0
+
+TestObject {
+ Component.onCompleted: {
+ increment()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 07ae9821e9..45f312e934 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -341,6 +341,7 @@ private slots:
void redefineGlobalProp();
void freeze_empty_object();
void singleBlockLoops();
+ void qtbug_60547();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -8358,6 +8359,16 @@ void tst_qqmlecmascript::singleBlockLoops()
QVERIFY(!component.isError());
}
+// 'counter' was incorrectly resolved as a type rather than a variable.
+// This fix ensures it looks up the right thing.
+void tst_qqmlecmascript::qtbug_60547()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug60547/main.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
+ QCOMPARE(object->property("counter"), QVariant(int(1)));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlsettings/data/aliases.qml b/tests/auto/qml/qqmlsettings/data/aliases.qml
index 18bd7a0e07..dd11147532 100644
--- a/tests/auto/qml/qqmlsettings/data/aliases.qml
+++ b/tests/auto/qml/qqmlsettings/data/aliases.qml
@@ -38,8 +38,10 @@ QtObject {
property double doubleProperty: 3.45
property string stringProperty: "foo"
property url urlProperty: "http://www.qt-project.org"
+ property var objectProperty: {"foo":"bar"}
property var intListProperty: [1, 2, 3]
property var stringListProperty: ["a", "b", "c"]
+ property var objectListProperty: [{"a":"b"}, {"c":"d"}]
property date dateProperty: "2000-01-02"
// QTBUG-32295: Expected property type
//property time timeProperty: "12:34:56"
@@ -58,8 +60,10 @@ QtObject {
property alias doubleProperty: root.doubleProperty
property alias stringProperty: root.stringProperty
property alias urlProperty: root.urlProperty
+ property alias objectProperty: root.objectProperty
property alias intListProperty: root.intListProperty
property alias stringListProperty: root.stringListProperty
+ property alias objectListProperty: root.objectListProperty
property alias dateProperty: root.dateProperty
// QTBUG-32295: Expected property type
//property alias timeProperty: root.timeProperty
diff --git a/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml b/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml
index 8540838fb9..f5b18d1825 100644
--- a/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml
+++ b/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml
@@ -40,8 +40,10 @@ CppObject {
property alias doubleProperty: obj.doubleProperty
property alias stringProperty: obj.stringProperty
property alias urlProperty: obj.urlProperty
+ property alias objectProperty: obj.objectProperty
property alias intListProperty: obj.intListProperty
property alias stringListProperty: obj.stringListProperty
+ property alias objectListProperty: obj.objectListProperty
property alias dateProperty: obj.dateProperty
// QTBUG-32295: Expected property type
//property alias timeProperty: obj.timeProperty
diff --git a/tests/auto/qml/qqmlsettings/data/types.qml b/tests/auto/qml/qqmlsettings/data/types.qml
index d1301af057..c4efa0be7c 100644
--- a/tests/auto/qml/qqmlsettings/data/types.qml
+++ b/tests/auto/qml/qqmlsettings/data/types.qml
@@ -38,8 +38,10 @@ QtObject {
property double doubleProperty
property string stringProperty
property url urlProperty
+ property var objectProperty
property var intListProperty
property var stringListProperty
+ property var objectListProperty
property date dateProperty
// QTBUG-32295: Expected property type
// property time timeProperty
@@ -64,8 +66,10 @@ QtObject {
to.doubleProperty = from.doubleProperty
to.stringProperty = from.stringProperty
to.urlProperty = from.urlProperty
+ to.objectProperty = from.objectProperty
to.intListProperty = from.intListProperty
to.stringListProperty = from.stringListProperty
+ to.objectListProperty = from.objectListProperty
to.dateProperty = from.dateProperty
//to.timeProperty = from.timeProperty
to.sizeProperty = from.sizeProperty
@@ -84,8 +88,10 @@ QtObject {
property double doubleProperty: 3.45
property string stringProperty: "foo"
property url urlProperty: "http://www.qt-project.org"
+ property var objectProperty: {"foo":"bar"}
property var intListProperty: [1, 2, 3]
property var stringListProperty: ["a", "b", "c"]
+ property var objectListProperty: [{"a":"b"}, {"c":"d"}]
property date dateProperty: "2000-01-02"
// QTBUG-32295: Expected property type
//property time timeProperty: "12:34:56"
diff --git a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
index c2e20f8892..e08389045c 100644
--- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
+++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp
@@ -55,25 +55,36 @@ private slots:
void initial();
};
+// ### Replace keyValueMap("foo", "bar") with QVariantMap({{"foo", "bar"}})
+// when C++11 uniform initialization can be used (not supported by MSVC 2013).
+static QVariantMap keyValueMap(const QString &key, const QString &value)
+{
+ QVariantMap var;
+ var.insert(key, value);
+ return var;
+}
+
class CppObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty NOTIFY intPropertyChanged)
- Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty NOTIFY boolPropertyChanged)
- Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty NOTIFY realPropertyChanged)
- Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty NOTIFY doublePropertyChanged)
- Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringPropertyChanged)
- Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty NOTIFY urlPropertyChanged)
- Q_PROPERTY(QVariant varProperty READ varProperty WRITE setVarProperty NOTIFY varPropertyChanged)
- Q_PROPERTY(QVariantList intListProperty READ intListProperty WRITE setIntListProperty NOTIFY intListPropertyChanged)
- Q_PROPERTY(QVariantList stringListProperty READ stringListProperty WRITE setStringListProperty NOTIFY stringListPropertyChanged)
- Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty NOTIFY datePropertyChanged)
- // QTBUG-32295: Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty NOTIFY timePropertyChanged)
- Q_PROPERTY(QSizeF sizeProperty READ sizeProperty WRITE setSizeProperty NOTIFY sizePropertyChanged)
- Q_PROPERTY(QPointF pointProperty READ pointProperty WRITE setPointProperty NOTIFY pointPropertyChanged)
- Q_PROPERTY(QRectF rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged)
- Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty NOTIFY colorPropertyChanged)
- Q_PROPERTY(QFont fontProperty READ fontProperty WRITE setFontProperty NOTIFY fontPropertyChanged)
+ Q_PROPERTY(int intProperty MEMBER m_intProperty NOTIFY intPropertyChanged)
+ Q_PROPERTY(bool boolProperty MEMBER m_boolProperty NOTIFY boolPropertyChanged)
+ Q_PROPERTY(qreal realProperty MEMBER m_realProperty NOTIFY realPropertyChanged)
+ Q_PROPERTY(double doubleProperty MEMBER m_doubleProperty NOTIFY doublePropertyChanged)
+ Q_PROPERTY(QString stringProperty MEMBER m_stringProperty NOTIFY stringPropertyChanged)
+ Q_PROPERTY(QUrl urlProperty MEMBER m_urlProperty NOTIFY urlPropertyChanged)
+ Q_PROPERTY(QVariant varProperty MEMBER m_varProperty NOTIFY varPropertyChanged)
+ Q_PROPERTY(QVariantMap objectProperty MEMBER m_objectProperty NOTIFY objectPropertyChanged)
+ Q_PROPERTY(QVariantList intListProperty MEMBER m_intListProperty NOTIFY intListPropertyChanged)
+ Q_PROPERTY(QVariantList stringListProperty MEMBER m_stringListProperty NOTIFY stringListPropertyChanged)
+ Q_PROPERTY(QVariantList objectListProperty MEMBER m_objectListProperty NOTIFY objectListPropertyChanged)
+ Q_PROPERTY(QDate dateProperty MEMBER m_dateProperty NOTIFY datePropertyChanged)
+ // QTBUG-32295: Q_PROPERTY(QTime timeProperty MEMBER m_timeProperty NOTIFY timePropertyChanged)
+ Q_PROPERTY(QSizeF sizeProperty MEMBER m_sizeProperty NOTIFY sizePropertyChanged)
+ Q_PROPERTY(QPointF pointProperty MEMBER m_pointProperty NOTIFY pointPropertyChanged)
+ Q_PROPERTY(QRectF rectProperty MEMBER m_rectProperty NOTIFY rectPropertyChanged)
+ Q_PROPERTY(QColor colorProperty MEMBER m_colorProperty NOTIFY colorPropertyChanged)
+ Q_PROPERTY(QFont fontProperty MEMBER m_fontProperty NOTIFY fontPropertyChanged)
public:
CppObject(QObject *parent = 0) : QObject(parent),
@@ -83,8 +94,10 @@ public:
m_doubleProperty(3.45),
m_stringProperty("foo"),
m_urlProperty("http://www.qt-project.org"),
+ m_objectProperty(keyValueMap("foo", "bar")),
m_intListProperty(QVariantList() << 1 << 2 << 3),
m_stringListProperty(QVariantList() << "a" << "b" << "c"),
+ m_objectListProperty(QVariantList() << keyValueMap("a", "b") << keyValueMap("c", "d")),
m_dateProperty(2000, 1, 2),
// QTBUG-32295: m_timeProperty(12, 34, 56),
m_sizeProperty(12, 34),
@@ -94,143 +107,6 @@ public:
{
}
- int intProperty() const { return m_intProperty; }
- bool boolProperty() const { return m_boolProperty; }
- qreal realProperty() const { return m_realProperty; }
- double doubleProperty() const { return m_doubleProperty; }
- QString stringProperty() const { return m_stringProperty; }
- QUrl urlProperty() const { return m_urlProperty; }
- QVariant varProperty() const { return m_varProperty; }
- QVariantList intListProperty() const { return m_intListProperty; }
- QVariantList stringListProperty() const { return m_stringListProperty; }
- QDate dateProperty() const { return m_dateProperty; }
- QSizeF sizeProperty() const { return m_sizeProperty; }
- QPointF pointProperty() const { return m_pointProperty; }
- QRectF rectProperty() const { return m_rectProperty; }
- QColor colorProperty() const { return m_colorProperty; }
- QFont fontProperty() const { return m_fontProperty; }
-
-public slots:
- void setIntProperty(int arg)
- {
- if (m_intProperty != arg) {
- m_intProperty = arg;
- emit intPropertyChanged(arg);
- }
- }
-
- void setBoolProperty(bool arg)
- {
- if (m_boolProperty != arg) {
- m_boolProperty = arg;
- emit boolPropertyChanged(arg);
- }
- }
-
- void setRealProperty(qreal arg)
- {
- if (m_realProperty != arg) {
- m_realProperty = arg;
- emit realPropertyChanged(arg);
- }
- }
-
- void setDoubleProperty(double arg)
- {
- if (m_doubleProperty != arg) {
- m_doubleProperty = arg;
- emit doublePropertyChanged(arg);
- }
- }
-
- void setStringProperty(const QString &arg)
- {
- if (m_stringProperty != arg) {
- m_stringProperty = arg;
- emit stringPropertyChanged(arg);
- }
- }
-
- void setUrlProperty(const QUrl &arg)
- {
- if (m_urlProperty != arg) {
- m_urlProperty = arg;
- emit urlPropertyChanged(arg);
- }
- }
-
- void setVarProperty(const QVariant &arg)
- {
- if (m_varProperty != arg) {
- m_varProperty = arg;
- emit varPropertyChanged(arg);
- }
- }
-
- void setIntListProperty(const QVariantList &arg)
- {
- if (m_intListProperty != arg) {
- m_intListProperty = arg;
- emit intListPropertyChanged(arg);
- }
- }
-
- void setStringListProperty(const QVariantList &arg)
- {
- if (m_stringListProperty != arg) {
- m_stringListProperty = arg;
- emit stringListPropertyChanged(arg);
- }
- }
-
- void setDateProperty(const QDate &arg)
- {
- if (m_dateProperty != arg) {
- m_dateProperty = arg;
- emit datePropertyChanged(arg);
- }
- }
-
- void setSizeProperty(const QSizeF &arg)
- {
- if (m_sizeProperty != arg) {
- m_sizeProperty = arg;
- emit sizePropertyChanged(arg);
- }
- }
-
- void setPointProperty(const QPointF &arg)
- {
- if (m_pointProperty != arg) {
- m_pointProperty = arg;
- emit pointPropertyChanged(arg);
- }
- }
-
- void setRectProperty(const QRectF &arg)
- {
- if (m_rectProperty != arg) {
- m_rectProperty = arg;
- emit rectPropertyChanged(arg);
- }
- }
-
- void setColorProperty(const QColor &arg)
- {
- if (m_colorProperty != arg) {
- m_colorProperty = arg;
- emit colorPropertyChanged(arg);
- }
- }
-
- void setFontProperty(const QFont &arg)
- {
- if (m_fontProperty != arg) {
- m_fontProperty = arg;
- emit fontPropertyChanged(arg);
- }
- }
-
signals:
void intPropertyChanged(int arg);
void boolPropertyChanged(bool arg);
@@ -239,8 +115,10 @@ signals:
void stringPropertyChanged(const QString &arg);
void urlPropertyChanged(const QUrl &arg);
void varPropertyChanged(const QVariant &arg);
+ void objectPropertyChanged(const QVariantMap &arg);
void intListPropertyChanged(const QVariantList &arg);
void stringListPropertyChanged(const QVariantList &arg);
+ void objectListPropertyChanged(const QVariantList &arg);
void datePropertyChanged(const QDate &arg);
void sizePropertyChanged(const QSizeF &arg);
void pointPropertyChanged(const QPointF &arg);
@@ -256,8 +134,10 @@ private:
QString m_stringProperty;
QUrl m_urlProperty;
QVariant m_varProperty;
+ QVariantMap m_objectProperty;
QVariantList m_intListProperty;
QVariantList m_stringListProperty;
+ QVariantList m_objectListProperty;
QDate m_dateProperty;
QSizeF m_sizeProperty;
QPointF m_pointProperty;
@@ -316,8 +196,10 @@ void tst_QQmlSettings::types()
QCOMPARE(root->property("doubleProperty").toDouble(), static_cast<double>(0.0));
QCOMPARE(root->property("stringProperty").toString(), QString());
QCOMPARE(root->property("urlProperty").toUrl(), QUrl());
+ QCOMPARE(root->property("objectProperty").toMap(), QVariantMap());
QCOMPARE(root->property("intListProperty").toList(), QVariantList());
QCOMPARE(root->property("stringListProperty").toList(), QVariantList());
+ QCOMPARE(root->property("objectListProperty").toList(), QVariantList());
QCOMPARE(root->property("dateProperty").toDate(), QDate());
// QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime());
QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF());
@@ -333,8 +215,10 @@ void tst_QQmlSettings::types()
QCOMPARE(settings->property("doubleProperty").toDouble(), static_cast<double>(3.45));
QCOMPARE(settings->property("stringProperty").toString(), QStringLiteral("foo"));
QCOMPARE(settings->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org"));
+ QCOMPARE(settings->property("objectProperty").toMap(), keyValueMap("foo","bar"));
QCOMPARE(settings->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3);
QCOMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c"));
+ QCOMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d"));
QCOMPARE(settings->property("dateProperty").toDate(), QDate(2000, 01, 02));
// QTBUG-32295: QCOMPARE(settings->property("timeProperty").toDate(), QTime(12, 34, 56));
QCOMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(12, 34));
@@ -351,9 +235,11 @@ void tst_QQmlSettings::types()
QCOMPARE(root->property("doubleProperty").toDouble(), static_cast<double>(3.45));
QCOMPARE(root->property("stringProperty").toString(), QStringLiteral("foo"));
QCOMPARE(root->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org"));
+ QCOMPARE(root->property("objectProperty").toMap(), keyValueMap("foo","bar"));
QCOMPARE(root->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3);
QCOMPARE(root->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c"));
QCOMPARE(root->property("dateProperty").toDate(), QDate(2000, 01, 02));
+ QCOMPARE(root->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d"));
// QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime(12, 34, 56));
QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF(12, 34));
QCOMPARE(root->property("pointProperty").toPointF(), QPointF(12, 34));
@@ -368,8 +254,10 @@ void tst_QQmlSettings::types()
QVERIFY(root->setProperty("doubleProperty", static_cast<double>(6.78)));
QVERIFY(root->setProperty("stringProperty", QStringLiteral("bar")));
QVERIFY(root->setProperty("urlProperty", QUrl("https://codereview.qt-project.org")));
+ QVERIFY(root->setProperty("objectProperty", keyValueMap("bar", "baz")));
QVERIFY(root->setProperty("intListProperty", QVariantList() << 4 << 5 << 6));
QVERIFY(root->setProperty("stringListProperty", QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")));
+ QVERIFY(root->setProperty("objectListProperty", QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")));
QVERIFY(root->setProperty("dateProperty", QDate(2010, 02, 01)));
// QTBUG-32295: QVERIFY(root->setProperty("timeProperty", QTime(6, 56, 34)));
QVERIFY(root->setProperty("sizeProperty", QSizeF(56, 78)));
@@ -387,8 +275,10 @@ void tst_QQmlSettings::types()
QTRY_COMPARE(settings->property("doubleProperty").toDouble(), static_cast<double>(6.78));
QTRY_COMPARE(settings->property("stringProperty").toString(), QStringLiteral("bar"));
QTRY_COMPARE(settings->property("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org"));
+ QTRY_COMPARE(settings->property("objectProperty").toMap(), keyValueMap("bar", "baz"));
QTRY_COMPARE(settings->property("intListProperty").toList(), QVariantList() << 4 << 5 << 6);
QTRY_COMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f"));
+ QTRY_COMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h"));
QTRY_COMPARE(settings->property("dateProperty").toDate(), QDate(2010, 02, 01));
// QTBUG-32295: QTRY_COMPARE(settings->property("timeProperty").toDate(), QTime(6, 56, 34));
QTRY_COMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(56, 78));
@@ -404,8 +294,10 @@ void tst_QQmlSettings::types()
QTRY_COMPARE(qs.value("doubleProperty").toDouble(), static_cast<double>(6.78));
QTRY_COMPARE(qs.value("stringProperty").toString(), QStringLiteral("bar"));
QTRY_COMPARE(qs.value("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org"));
+ QTRY_COMPARE(qs.value("objectProperty").toMap(), keyValueMap("bar", "baz"));
QTRY_COMPARE(qs.value("intListProperty").toList(), QVariantList() << 4 << 5 << 6);
QTRY_COMPARE(qs.value("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f"));
+ QTRY_COMPARE(qs.value("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h"));
QTRY_COMPARE(qs.value("dateProperty").toDate(), QDate(2010, 02, 01));
// QTBUG-32295: QTRY_COMPARE(qs.value("timeProperty").toDate(), QTime(6, 56, 34));
QTRY_COMPARE(qs.value("sizeProperty").toSizeF(), QSizeF(56, 78));
@@ -440,8 +332,10 @@ void tst_QQmlSettings::aliases()
QCOMPARE(root->property("doubleProperty").toDouble(), static_cast<double>(3.45));
QCOMPARE(root->property("stringProperty").toString(), QStringLiteral("foo"));
QCOMPARE(root->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org"));
+ QCOMPARE(root->property("objectProperty").toMap(), keyValueMap("foo","bar"));
QCOMPARE(root->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3);
QCOMPARE(root->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c"));
+ QCOMPARE(root->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d"));
QCOMPARE(root->property("dateProperty").toDate(), QDate(2000, 01, 02));
// QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime(12, 34, 56));
QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF(12, 34));
@@ -457,8 +351,10 @@ void tst_QQmlSettings::aliases()
QCOMPARE(settings->property("doubleProperty").toDouble(), static_cast<double>(3.45));
QCOMPARE(settings->property("stringProperty").toString(), QStringLiteral("foo"));
QCOMPARE(settings->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org"));
+ QCOMPARE(settings->property("objectProperty").toMap(), keyValueMap("foo","bar"));
QCOMPARE(settings->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3);
QCOMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c"));
+ QCOMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d"));
QCOMPARE(settings->property("dateProperty").toDate(), QDate(2000, 01, 02));
// QTBUG-32295: QCOMPARE(settings->property("timeProperty").toDate(), QTime(12, 34, 56));
QCOMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(12, 34));
@@ -474,8 +370,10 @@ void tst_QQmlSettings::aliases()
QVERIFY(settings->setProperty("doubleProperty", static_cast<double>(6.78)));
QVERIFY(settings->setProperty("stringProperty", QStringLiteral("bar")));
QVERIFY(settings->setProperty("urlProperty", QUrl("https://codereview.qt-project.org")));
+ QVERIFY(settings->setProperty("objectProperty", keyValueMap("bar", "baz")));
QVERIFY(settings->setProperty("intListProperty", QVariantList() << 4 << 5 << 6));
QVERIFY(settings->setProperty("stringListProperty", QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")));
+ QVERIFY(settings->setProperty("objectListProperty", QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")));
QVERIFY(settings->setProperty("dateProperty", QDate(2010, 02, 01)));
// QTBUG-32295: QVERIFY(settings->setProperty("timeProperty", QTime(6, 56, 34)));
QVERIFY(settings->setProperty("sizeProperty", QSizeF(56, 78)));
@@ -492,8 +390,10 @@ void tst_QQmlSettings::aliases()
QTRY_COMPARE(qs.value("doubleProperty").toDouble(), static_cast<double>(6.78));
QTRY_COMPARE(qs.value("stringProperty").toString(), QStringLiteral("bar"));
QTRY_COMPARE(qs.value("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org"));
+ QTRY_COMPARE(qs.value("objectProperty").toMap(), keyValueMap("bar", "baz"));
QTRY_COMPARE(qs.value("intListProperty").toList(), QVariantList() << 4 << 5 << 6);
QTRY_COMPARE(qs.value("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f"));
+ QTRY_COMPARE(qs.value("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h"));
QTRY_COMPARE(qs.value("dateProperty").toDate(), QDate(2010, 02, 01));
// QTBUG-32295: QTRY_COMPARE(qs.value("timeProperty").toDate(), QTime(6, 56, 34));
QTRY_COMPARE(qs.value("sizeProperty").toSizeF(), QSizeF(56, 78));
diff --git a/tests/auto/quick/qquickview/data/findChild.qml b/tests/auto/quick/qquickview/data/findChild.qml
new file mode 100644
index 0000000000..8cbc46abe2
--- /dev/null
+++ b/tests/auto/quick/qquickview/data/findChild.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+Item {
+ width: 200
+ height: 200
+ objectName: "rootObject"
+ Item {
+ objectName: "rootObjectChild"
+ }
+}
diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp
index fa9192edb4..04d21457e6 100644
--- a/tests/auto/quick/qquickview/tst_qquickview.cpp
+++ b/tests/auto/quick/qquickview/tst_qquickview.cpp
@@ -70,6 +70,7 @@ private slots:
void resizemodeitem();
void errors();
void engine();
+ void findChild();
};
@@ -265,6 +266,45 @@ void tst_QQuickView::engine()
delete view4;
}
+void tst_QQuickView::findChild()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("findChild.qml"));
+
+ // QQuickView
+ // |_ QQuickWindow::contentItem
+ // | |_ QQuickView::rootObject: QML Item("rootObject") (findChild.qml)
+ // | | |_ QML Item("rootObjectChild") (findChild.qml)
+ // | |_ QObject("contentItemChild")
+ // |_ QObject("viewChild")
+
+ QObject *viewChild = new QObject(&view);
+ viewChild->setObjectName("viewChild");
+
+ QObject *contentItemChild = new QObject(view.contentItem());
+ contentItemChild->setObjectName("contentItemChild");
+
+ QObject *rootObject = view.rootObject();
+ QVERIFY(rootObject);
+
+ QObject *rootObjectChild = rootObject->findChild<QObject *>("rootObjectChild");
+ QVERIFY(rootObjectChild);
+
+ QCOMPARE(view.findChild<QObject *>("viewChild"), viewChild);
+ QCOMPARE(view.findChild<QObject *>("contentItemChild"), contentItemChild);
+ QCOMPARE(view.findChild<QObject *>("rootObject"), rootObject);
+ QCOMPARE(view.findChild<QObject *>("rootObjectChild"), rootObjectChild);
+
+ QVERIFY(!view.contentItem()->findChild<QObject *>("viewChild")); // sibling
+ QCOMPARE(view.contentItem()->findChild<QObject *>("contentItemChild"), contentItemChild);
+ QCOMPARE(view.contentItem()->findChild<QObject *>("rootObject"), rootObject);
+ QCOMPARE(view.contentItem()->findChild<QObject *>("rootObjectChild"), rootObjectChild);
+
+ QVERIFY(!view.rootObject()->findChild<QObject *>("viewChild")); // ancestor
+ QVERIFY(!view.rootObject()->findChild<QObject *>("contentItemChild")); // cousin
+ QVERIFY(!view.rootObject()->findChild<QObject *>("rootObject")); // self
+}
+
QTEST_MAIN(tst_QQuickView)
#include "tst_qquickview.moc"
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index f2eb6a6685..91d577fb6f 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -375,7 +375,7 @@ private slots:
void testDragEventPropertyPropagation();
- void createTextureFromImage();
+ void findChild();
private:
QTouchDevice *touchDevice;
@@ -2827,13 +2827,26 @@ void tst_qquickwindow::testDragEventPropertyPropagation()
}
}
-void tst_qquickwindow::createTextureFromImage()
+void tst_qquickwindow::findChild()
{
- // An invalid image should return a null pointer.
QQuickWindow window;
- window.show();
- QTest::qWaitForWindowExposed(&window);
- QVERIFY(!window.createTextureFromImage(QImage()));
+
+ // QQuickWindow
+ // |_ QQuickWindow::contentItem
+ // | |_ QObject("contentItemChild")
+ // |_ QObject("viewChild")
+
+ QObject *windowChild = new QObject(&window);
+ windowChild->setObjectName("windowChild");
+
+ QObject *contentItemChild = new QObject(window.contentItem());
+ contentItemChild->setObjectName("contentItemChild");
+
+ QCOMPARE(window.findChild<QObject *>("windowChild"), windowChild);
+ QCOMPARE(window.findChild<QObject *>("contentItemChild"), contentItemChild);
+
+ QVERIFY(!window.contentItem()->findChild<QObject *>("viewChild")); // sibling
+ QCOMPARE(window.contentItem()->findChild<QObject *>("contentItemChild"), contentItemChild);
}
QTEST_MAIN(tst_qquickwindow)
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index bd051ec990..60495596d1 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -59,6 +59,7 @@ private slots:
void reparentToNewWindow();
void nullEngine();
void keyEvents();
+ void shortcuts();
};
@@ -365,6 +366,38 @@ void tst_qquickwidget::keyEvents()
QTRY_VERIFY(widget.ok);
}
+class ShortcutEventFilter : public QObject
+{
+public:
+ bool eventFilter(QObject *obj, QEvent *e) override {
+ if (e->type() == QEvent::ShortcutOverride)
+ shortcutOk = true;
+
+ return QObject::eventFilter(obj, e);
+ }
+
+ bool shortcutOk = false;
+};
+
+void tst_qquickwidget::shortcuts()
+{
+ // Verify that ShortcutOverride events do not get lost. (QTBUG-60988)
+ KeyHandlingWidget widget;
+ widget.setSource(testFileUrl("rectangle.qml"));
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(widget.window(), 5000));
+
+ // Send to the widget, verify that the QQuickWindow sees it.
+
+ ShortcutEventFilter filter;
+ widget.quickWindow()->installEventFilter(&filter);
+
+ QKeyEvent e(QEvent::ShortcutOverride, Qt::Key_A, Qt::ControlModifier);
+ QCoreApplication::sendEvent(&widget, &e);
+
+ QTRY_VERIFY(filter.shortcutOk);
+}
+
QTEST_MAIN(tst_qquickwidget)
#include "tst_qquickwidget.moc"
diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
index 4470db0d09..330da358b7 100644
--- a/tools/qmlcachegen/qmlcache.prf
+++ b/tools/qmlcachegen/qmlcache.prf
@@ -3,6 +3,11 @@ static {
return()
}
+android {
+ message("QML cache generation ahead of time is not supported on Android")
+ return()
+}
+
qtPrepareTool(QML_CACHEGEN, qmlcachegen, _ARCH_CHECK)
isEmpty(TARGETPATH): error("Must set TARGETPATH (QML import name) for ahead-of-time QML cache generation")