Reputation: 9624
I'm simply trying to create a TableView in my QML file, like so -
TableView {
id: resultListTableView
anchors.fill: parent
rowDelegate: Rectangle {
color: "#D3D3D3"
height: 30
}
itemDelegate: Rectangle {
width: 100
height: 50
border.color: "#000000"
border.width: 1
Text {
id: textItem
text: styleData.value
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
}
}
headerDelegate: Rectangle {
height: textItem.implicitHeight * 1.2
width: textItem.implicitWidth
color: "lightsteelblue"
Text {
id: textItem
anchors.centerIn: parent
text: styleData.value
elide: Text.ElideRight
}
}
TableViewColumn {
role: "file"
title: "File"
width: resultListTableView.viewport.width * 0.3
movable: false
resizable: false
}
TableViewColumn {
role: "type"
title: "Type"
width: resultListTableView.viewport.width * 0.2
movable: false
resizable: false
}
TableViewColumn {
role: "size"
title: "Size"
width: resultListTableView.viewport.width * 0.2
movable: false
resizable: false
}
TableViewColumn {
role: "path"
title: "Path"
width: resultListTableView.viewport.width * 0.3
movable: false
resizable: false
}
model: ResultListDataModel {}
onDoubleClicked: {
const element = model.get(row)
console.log("Downloading file ", element.file, "of size", element.size)
}
}
This component is part of a TabView and shows up when the corresponding tab is clicked. When the tab is clicked though, I randomly get a binding loop warning:
QML TableView: Binding loop detected for property "__scrollBarTopMargin"
I'm not doing anything that might result in this binding loop, so I'm wondering where the issue is. Anybody knows what's going on here?
Upvotes: 1
Views: 880
Reputation: 2556
Pure speculation without a Qt dev environment handy, but I'd guess the viewport depends on the width of the columns, while the width of the columns now depends on the viewport.
Hacking out the four lines that set width for the columns would prove or disprove real quick.
If that wild guess didn't work, from the source here, https://github.com/qt-creator/qt-creator/blob/master/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml, I see __scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0
.
You might consider hacking out your header delegate to see if that removes the warning.
Oh wow, that ID duplication was subtle. As you said yourself, it seems that having the duplicated ID messed with your sizing. Wish that was the first warning you got, not the crazy one you actually got.
Upvotes: 1