В следующем коде:
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
}
}
}
}
Если я закомментирую строки, устанавливающие делегаты строки и элемента (строки, которые я пометил с помощью «//comment out»), то таблица будет отображаться нормально, что свидетельствует о том, что указанная мной модель верна. Однако, когда я устанавливаю делегаты строки и элемента, я получаю только первую строку таблицы.
Может ли кто-нибудь указать мне, что не так во втором случае (с делегатами строк и элементов)?