In the following code:
Rectangle{
width: { parent==null ? 640: parent.width }
height: { parent==null ? 480: parent.height }
Image {
id: mainBackground
anchors.fill: parent
source: "qrc:///wallDiscoveryBackground"
fillMode: Image.PreserveAspectFit
TableView {
id: wallDiscoveryTable
anchors.margins: parent.width * 0.6
width: parent.width
clip: true
model: discoveredWallsTableModel
TableViewColumn { role: "name"; width: 240; title: "Name" }
TableViewColumn { role: "ipAddress"; width: 240; title: "IP Address" }
TableViewColumn { role: "status"; width: 240; title: "Status" }
rowDelegate: wallDiscoveryRowDelegate //comment out
itemDelegate: wallDiscoveryItemDelegate //comment out
}
Component {
id: wallDiscoveryRowDelegate
Rectangle {
width: wallDiscoveryTable.width
height: 640
}
}
Component {
id: wallDiscoveryItemDelegate
Text {
anchors.verticalCenter: parent.verticalCenter
color: styleData.textColor
text: styleData.value
}
}
}
}
If I comment out lines setting the row and item delegates (lines I have marked with "//comment out") then the table renders fine, indicative of the fact that the model I have specified is right. However, when I set the row and item delegates, I only get the first row of the table rendered.
Can someone point me to what is wrong in the second case (with row and item delegates)?
Your delegate is huge. 640 pixels is more than half the height of most screens. Your code doesn't run properly since the model doesn't exist, but if I use a dummy model and reduce the height to 100 pixels, I see other items. Also, you should be able to scroll down to see the other items, even with your current code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.