aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-09-25 18:55:07 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-09-25 18:55:07 +0200
commit4f956e914a2cfbb3cb440a3b67498f1b3cda8094 (patch)
tree0e0e5c10034bdb24708d4e49d9c9e516801c1e4b
parentded4582e67a06d849bb4d993e60c757f58979968 (diff)
parentf17b826a72d77379288aa84a933b9231c279cbad (diff)
Merge 5.9 into 5.9.2
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h2
-rw-r--r--src/qml/types/qqmllistmodel.cpp66
-rw-r--r--src/qml/types/qqmllistmodel_p.h2
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h1
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp3
-rw-r--r--tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml10
-rw-r--r--tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml14
-rw-r--r--tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp9
8 files changed, 66 insertions, 41 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index ede1dd74f9..2dff2b7a01 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -112,6 +112,8 @@ public:
if (it->m_propertyIndex == propertyIndex)
return true;
}
+ if (auto parentInterceptor = ((parent.isT1() && parent.flag()) ? static_cast<QQmlInterceptorMetaObject *>(parent.asT1()) : 0))
+ return parentInterceptor->intercepts(propertyIndex);
return false;
}
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 35ee30dccf..2b4e906617 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -341,7 +341,9 @@ ListModel::ListModel(ListLayout *layout, QQmlListModel *modelCache, int uid) : m
void ListModel::destroy()
{
- clear();
+ for (const auto &destroyer : remove(0, elements.count()))
+ destroyer();
+
m_uid = -1;
m_layout = 0;
if (m_modelCache && m_modelCache->m_primary == false)
@@ -557,16 +559,6 @@ void ListModel::set(int elementIndex, QV4::Object *object)
}
}
-void ListModel::clear()
-{
- int elementCount = elements.count();
- for (int i=0 ; i < elementCount ; ++i) {
- elements[i]->destroy(m_layout);
- delete elements[i];
- }
- elements.clear();
-}
-
QVector<std::function<void()>> ListModel::remove(int index, int count)
{
QVector<std::function<void()>> toDestroy;
@@ -2025,18 +2017,7 @@ int QQmlListModel::count() const
*/
void QQmlListModel::clear()
{
- const int cleared = count();
-
- emitItemsAboutToBeRemoved(0, cleared);
-
- if (m_dynamicRoles) {
- qDeleteAll(m_modelObjects);
- m_modelObjects.clear();
- } else {
- m_listModel->clear();
- }
-
- emitItemsRemoved(0, cleared);
+ removeElements(0, count());
}
/*!
@@ -2060,27 +2041,32 @@ void QQmlListModel::remove(QQmlV4Function *args)
return;
}
- emitItemsAboutToBeRemoved(index, removeCount);
+ removeElements(index, removeCount);
+ } else {
+ qmlWarning(this) << tr("remove: incorrect number of arguments");
+ }
+}
- QVector<std::function<void()>> toDestroy;
- if (m_dynamicRoles) {
- for (int i=0 ; i < removeCount ; ++i) {
- auto modelObject = m_modelObjects[index+i];
- toDestroy.append([modelObject](){
- delete modelObject;
- });
- }
- m_modelObjects.remove(index, removeCount);
- } else {
- toDestroy = m_listModel->remove(index, removeCount);
- }
+void QQmlListModel::removeElements(int index, int removeCount)
+{
+ emitItemsAboutToBeRemoved(index, removeCount);
- emitItemsRemoved(index, removeCount);
- for (const auto &destroyer : toDestroy)
- destroyer();
+ QVector<std::function<void()>> toDestroy;
+ if (m_dynamicRoles) {
+ for (int i=0 ; i < removeCount ; ++i) {
+ auto modelObject = m_modelObjects[index+i];
+ toDestroy.append([modelObject](){
+ delete modelObject;
+ });
+ }
+ m_modelObjects.remove(index, removeCount);
} else {
- qmlWarning(this) << tr("remove: incorrect number of arguments");
+ toDestroy = m_listModel->remove(index, removeCount);
}
+
+ emitItemsRemoved(index, removeCount);
+ for (const auto &destroyer : toDestroy)
+ destroyer();
}
/*!
diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h
index b750d30676..1fda703797 100644
--- a/src/qml/types/qqmllistmodel_p.h
+++ b/src/qml/types/qqmllistmodel_p.h
@@ -165,6 +165,8 @@ private:
void emitItemsInserted(int index, int count);
void emitItemsAboutToBeMoved(int from, int to, int n);
void emitItemsMoved(int from, int to, int n);
+
+ void removeElements(int index, int removeCount);
};
// ### FIXME
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index 4928ad3725..10916f10db 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -366,7 +366,6 @@ public:
int append(QV4::Object *object);
void insert(int elementIndex, QV4::Object *object);
- void clear();
Q_REQUIRED_RESULT QVector<std::function<void()>> remove(int index, int count);
int appendElement();
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 264b30b897..22d57001fc 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -1079,6 +1079,7 @@ void QSGGeometryNode::setInheritedOpacity(qreal opacity)
QSGClipNode::QSGClipNode()
: QSGBasicGeometryNode(ClipNodeType)
+ , m_is_rectangular(false)
{
Q_UNUSED(m_reserved);
}
@@ -1114,6 +1115,8 @@ QSGClipNode::~QSGClipNode()
When this hint is set and it is applicable, the clip region will be
generated from clipRect() rather than geometry().
+
+ By default this property is \c false.
*/
void QSGClipNode::setIsRectangular(bool rectHint)
diff --git a/tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml b/tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml
new file mode 100644
index 0000000000..09983645ef
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.4
+
+Item {
+ id: root
+
+ property bool someValue
+ Behavior on someValue {
+ ScriptAction { script: { parent.behaviorTriggered = true }}
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml b/tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml
new file mode 100644
index 0000000000..e627c45782
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.4
+
+Item {
+ property bool behaviorTriggered
+ property bool someProperty
+
+ ItemWithInnerBehavior {
+ //the existence of this property triggers the bug
+ property bool iDoAbsolutelyNothing
+
+ Component.onCompleted: parent.someProperty = true
+ someValue: parent.someProperty
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
index 80c76a377b..bdd53702e5 100644
--- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
+++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
@@ -72,6 +72,7 @@ private slots:
void currentValue();
void disabledWriteWhileRunning();
void aliasedProperty();
+ void innerBehaviorOverwritten();
};
void tst_qquickbehaviors::simpleBehavior()
@@ -589,6 +590,14 @@ void tst_qquickbehaviors::aliasedProperty()
//i.e. the behavior has been triggered
}
+void tst_qquickbehaviors::innerBehaviorOverwritten()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("overwrittenbehavior.qml"));
+ QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(c.create()));
+ QVERIFY(item->property("behaviorTriggered").toBool());
+}
+
QTEST_MAIN(tst_qquickbehaviors)
#include "tst_qquickbehaviors.moc"