Keyboard navigation in running scripts list

This commit is contained in:
Brad Davis 2016-02-08 14:12:18 -08:00
parent 63afa8c1ed
commit e376b781c1

View file

@ -90,6 +90,7 @@ Window {
}
ScrollView {
onActiveFocusChanged: if (activeFocus && listView.currentItem) { listView.currentItem.forceActiveFocus(); }
anchors {
top: allButtons.bottom;
left: parent.left;
@ -103,17 +104,19 @@ Window {
id: listView
clip: true
anchors { fill: parent; margins: 0 }
model: runningScriptsModel
delegate: Rectangle {
delegate: FocusScope {
id: scope
anchors { left: parent.left; right: parent.right }
height: scriptName.height + 12 + (ListView.isCurrentItem ? scriptName.height + 6 : 0)
Keys.onDownPressed: listView.incrementCurrentIndex()
Keys.onUpPressed: listView.decrementCurrentIndex()
Rectangle {
id: rectangle
anchors.fill: parent
clip: true
radius: 3
anchors { left: parent.left; right: parent.right }
height: scriptName.height + 12 + (ListView.isCurrentItem ? scriptName.height + 6 : 0)
color: ListView.isCurrentItem ? "#39f" :
color: scope.ListView.isCurrentItem ? "#79f" :
index % 2 ? "#ddd" : "#eee"
Text {
@ -131,7 +134,7 @@ Window {
MouseArea {
anchors.fill: parent
onClicked: listView.currentIndex = index
onClicked: { listView.currentIndex = index; scope.forceActiveFocus(); }
}
Row {
@ -157,6 +160,7 @@ Window {
}
}
}
}
Text {
id: loadLabel
@ -220,6 +224,7 @@ Window {
anchors.bottom: treeView.top
anchors.bottomMargin: 8
placeholderText: "filter"
focus: true
onTextChanged: scriptsModel.filterRegExp = new RegExp("^.*" + text + ".*$", "i")
Component.onCompleted: scriptsModel.filterRegExp = new RegExp("^.*$", "i")
}
@ -232,7 +237,6 @@ Window {
anchors.left: parent.left
anchors.right: parent.right
headerVisible: false
focus: true
// FIXME doesn't work?
onDoubleClicked: isExpanded(index) ? collapse(index) : expand(index)
// FIXME not triggered by double click?
@ -261,11 +265,11 @@ Window {
TableViewColumn {
title: "Name";
role: "display";
// delegate: Text {
// text: styleData.value
// renderType: Text.QtRendering
// elite: styleData.elideMode
// }
// delegate: Text {
// text: styleData.value
// renderType: Text.QtRendering
// elite: styleData.elideMode
// }
}
}