From 7e3e1295f4e240afc9532bc0ab47ff3644ffc008 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 4 Apr 2024 10:13:36 +0800 Subject: Doc: fix warning in ItemDelegate snippet The error was: TypeError: Cannot read property 'width' of null Pick-to: 6.5 6.7 Change-Id: I0505e806130769fb7a2ed77b18c80393476edafd Reviewed-by: Richard Moe Gustavsen --- src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate.qml') diff --git a/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate.qml b/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate.qml index 4d7fa30f22..33e9974094 100644 --- a/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate.qml +++ b/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate.qml @@ -6,6 +6,7 @@ import QtQuick.Controls //! [1] ListView { + id: listView width: 160 height: 240 @@ -13,7 +14,7 @@ ListView { delegate: ItemDelegate { text: modelData - width: parent.width + width: listView.width onClicked: console.log("clicked:", modelData) required property string modelData -- cgit v1.2.3