저는 C++에서 생성 된 복잡한 데이터 모델을 표시하기 위해 gridview를 사용하고 있습니다. gridview가 모든 keyNavigation 이벤트를 받아들이지 않거나 응답하지 않는다는 점을 제외하면 잘 작동합니다. 여기 내 코드가QML : Gridview 키보드 탐색이 작동하지 않습니다.
GridView{
id: gridView
anchors.fill: parent
clip: true
cellWidth: 315
cellHeight: 300/6+15
focus: true
model: system.DataList
highlightFollowsCurrentItem: true
keyNavigationEnabled: true//enabled but still doesnt work
//keyNavigationWraps: true//does this matter
highlight: Rectangle{
color: highlightColor
radius: 5
width: gridView.cellWidth
height: gridView.cellHeight
x: gridView.currentItem.x
y: gridView.currentItem.y
Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } }
Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } }
}
delegate: Component{
Rectangle{
id: viewParentRect
width: gridView.cellWidth;
height: diskListView.cellHeight - 15
color: "transparent"
Row{
anchors.fill: parent
Rectangle{
width: parent.width/6 ; height: parent.height
color: "transparent"
Image {
id: image
anchors.centerIn: parent
source: model.modelData.IconPath
sourceSize.width: parent.width
sourceSize.height: parent.height
}
}
Column{
Text {
id: displayName
text: model.modelData.DisplayName
font.family: "Sans Serif"
font.pointSize: viewParentRect.width/30
}
Text {
id: usageText
text: model.modelData.Usage
font.family: "Sans Serif"
font.pointSize: viewParentRect.width/30
}
}
}
MouseArea{
anchors.fill: parent
onClicked: {
gridView.currentIndex = index
}
onDoubleClicked: {
system.enter(model.modelData.Path)
}
}
}
}
}
특정 지점에서 중단 점을 유지하려고 시도했는데 아무런 키 누르기 이벤트가 전혀 발생하지 않았습니다. 위의 코드는 마우스로 잘 작동하지만 데스크톱 용으로 개발하고 있으므로 키보드 탐색이 제대로 작동해야합니다 (마우스 탐색이 작동하지 않더라도 문제는 아닙니다).