Both are Component (header and the row delegate), they will be instantiated later. Component are like a recipe to be instantiated, they can bind to actual instance into the current scope. So the current context doesn’t known the other instance value since the header is not an object instantiated but a Component. Both component has the ListView Context as parent Context. They are sibling Context so they do not known each other.
Bind the delegate tot connectionsList.width just like the header does and that should remove the bind issue with hostItem.width. If you need to have both value, add property into your listview that contain the value and both Component can bind to the ListView property instead. Jérôme Godbout, B. Ing. Software / Firmware Team Lead O: (418) 682-3636 ext.: 114 C: (581) 777-0050 godbo...@dimonoff.com<mailto:godbo...@dimonoff.com> [signature_1907764182]<https://www.dimonoff.com/> dimonoff.com<https://www.dimonoff.com/> 1015 Avenue Wilfrid-Pelletier, Québec, QC G1W 0C4, 4e étage From: Interest <interest-boun...@qt-project.org> on behalf of Alexander Dyagilev <alervd...@gmail.com> Date: Friday, April 16, 2021 at 7:25 AM To: interest@qt-project.org <interest@qt-project.org> Subject: [Interest] QML bug? Hello, Is this QML bug or am I misunderstanding something? It says: qrc:/qml_ui/desktop/BottomPanel/ConnectionsTab.qml:75: ReferenceError: hostItem is not defined qrc:/qml_ui/desktop/BottomPanel/ConnectionsTab.qml:84: ReferenceError: portItem is not defined Why are not they defined? These are ids of items defined in the same qml file. Code: import QtQuick 2.10 import QtQuick.Controls 2.4 import QtQuick.Layouts 1.3 import "../BaseElements" import org.freedownloadmanager.fdm 1.0 Item { anchors.fill: parent BaseLabel { text: qsTr("There are no connections") + App.loc.emptyString anchors.centerIn: parent visible: !connectionsList.visible font.pixelSize: 13 } ListView { id: connectionsList anchors.fill: parent anchors.bottomMargin: 1 ScrollBar.vertical: ScrollBar{} flickableDirection: Flickable.AutoFlickIfNeeded boundsBehavior: Flickable.StopAtBounds clip: true headerPositioning: ListView.OverlayHeader visible: downloadsItemTools.running && count model: downloadsItemTools.connectionsModel header: RowLayout { id: columns width: parent.width spacing: 0 z: 2 TablesHeaderItem { id: hostItem text: qsTr("Host") + width + App.loc.emptyString Layout.preferredWidth: Math.max(300, headerMinimumWidth) color: appWindow.theme.background } TablesHeaderItem { id: portItem text: qsTr("Port") + App.loc.emptyString Layout.preferredWidth: headerMinimumWidth color: appWindow.theme.background } TablesHeaderItem { id: countItem text: qsTr("Connection count") + App.loc.emptyString Layout.fillWidth: true color: appWindow.theme.background Rectangle { height: parent.height width: 1 anchors.right: parent.right color: appWindow.theme.border } } } delegate: RowLayout { width: parent.width height: 22 spacing: 0 BaseLabel { text: model.host Layout.preferredWidth: hostItem.width Layout.minimumWidth: Layout.preferredWidth Layout.fillHeight: true leftPadding: 6 Rectangle{anchors.fill: parent;color:"yellow";z:-1} } BaseLabel { text: model.port Layout.preferredWidth: portItem.width Layout.minimumWidth: Layout.preferredWidth Layout.fillHeight: true Rectangle{anchors.fill: parent;color:"red";z:-1} leftPadding: 6 } BaseLabel { text: model.connectionCount Layout.fillWidth: true Layout.fillHeight: true leftPadding: 6 Rectangle{anchors.fill: parent;color:"blue";z:-1} } } } }
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest