qt - Qml TreeView 只选择单元格而不是行
问题描述
我有一个 Treeview,我希望能够连续选择单元格并能够使用 Ctrl+C 复制它,但现在我只能选择行。我错过了 QML 代码中的某些内容还是取决于模型?
TreeView {
anchors.bottom: parent.bottom
anchors.top: rect.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10
model: modelka
itemDelegate: Item {
Text {
anchors.verticalCenter: parent.verticalCenter
color: "#000000"
elide: Text.ElideRight
text: styleData.value
width: parent.width
font.italic: modelka.data(styleData.index, 260)
}
}
TableViewColumn {
id: nameCol
title: "Наименование"
role: "name"
width: 220
}
TableViewColumn {
title: "Значение"
role: "value"
width: 240
}
TableViewColumn {
id: unitCol
title: "Ед.Изм."
role: "unit"
width: 80
}
rowDelegate: Rectangle {
color: getColor(styleData.selected, styleData.row)
}
}
解决方案
推荐阅读
- c++ - leetcode 65. 有效数字如何理解状态转移表
- visual-studio-code - 设置拆分编辑器敏感度 - VS Code
- c# - .Net Core API 如何处理 HTTP 异常
- kotlin - Kotlin 空指针异常
- c++ - 为什么命令不执行?
- javascript - NgRx Effects 使用无限循环使 Angular 应用程序崩溃
- android - Cloud Firestore / Firebase 带宽非常高
- ios - 有没有人可以清楚地将 PKDrawing 呈现为 PDF 的好方法?
- python - 除了 fig.show() 还有其他功能可以显示图形吗?
- smartcard - 尝试使用 ICAO 9303 BAC 从 National eID (T=0) 读取数据