From 456d26e97ec7745fdbd1afaaaa6c1dc217eca060 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 25 Feb 2020 12:16:39 +0100 Subject: Remove bindings to parent in delegates Until we've decided whether to a) document that properties of parent should not be bound to in delegates or b) fix the warning that results from doing so after 8c72e634b3b0eacbfdee883bfc34994d3c19ed77, we can pre-emptively clean up a few places where it happens. Task-number: QTBUG-81976 Task-number: QTBUG-82393 Task-number: QTBUG-82989 Pick-to: 5.15 Change-Id: I1e610613f6016ec1b9cf9ca33cdfb15d384731a8 Reviewed-by: Fabian Kosmale Reviewed-by: Richard Moe Gustavsen --- .../chattutorial/chapter3-navigation/ConversationPage.qml | 3 ++- .../quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml | 2 +- .../quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml | 2 +- .../chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/quickcontrols2/chattutorial') diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/ConversationPage.qml b/examples/quickcontrols2/chattutorial/chapter3-navigation/ConversationPage.qml index 90a846ac4b..9494219100 100644 --- a/examples/quickcontrols2/chattutorial/chapter3-navigation/ConversationPage.qml +++ b/examples/quickcontrols2/chattutorial/chapter3-navigation/ConversationPage.qml @@ -78,6 +78,7 @@ Page { anchors.fill: parent ListView { + id: listView Layout.fillWidth: true Layout.fillHeight: true Layout.margins: pane.leftPadding + messageField.leftPadding @@ -89,7 +90,7 @@ Page { delegate: Row { readonly property bool sentByMe: index % 2 == 0 - anchors.right: sentByMe ? parent.right : undefined + anchors.right: sentByMe ? listView.contentItem.right : undefined spacing: 6 Rectangle { diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml b/examples/quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml index 6684c2330f..d616fa388a 100644 --- a/examples/quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml +++ b/examples/quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml @@ -92,7 +92,7 @@ Page { recipient: inConversationWith } delegate: Column { - anchors.right: sentByMe ? parent.right : undefined + anchors.right: sentByMe ? listView.contentItem.right : undefined spacing: 6 readonly property bool sentByMe: model.recipient !== "Me" diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml b/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml index 790f9ee939..312384546a 100644 --- a/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml +++ b/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml @@ -92,7 +92,7 @@ Page { recipient: inConversationWith } delegate: Column { - anchors.right: sentByMe ? parent.right : undefined + anchors.right: sentByMe ? listView.contentItem.right : undefined spacing: 6 readonly property bool sentByMe: model.recipient !== "Me" diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc index 49e9806877..bc0ca84678 100644 --- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc +++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc @@ -490,7 +490,7 @@ we distinguish between different authors in three ways: \list \li Messages sent by the user are aligned to the right side of the screen -by setting \c anchors.right to \c parent.right. +by setting \c anchors.right to \c listView.contentItem.right. \li By setting the \c visible property of the avatar (which is simply a Rectangle for now) based on \c sentByMe, we only show it if the message was -- cgit v1.2.3