mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 13:43:49 +02:00
Keyboard navigation in running scripts list
This commit is contained in:
parent
63afa8c1ed
commit
e376b781c1
1 changed files with 53 additions and 49 deletions
|
@ -90,6 +90,7 @@ Window {
|
|||
}
|
||||
|
||||
ScrollView {
|
||||
onActiveFocusChanged: if (activeFocus && listView.currentItem) { listView.currentItem.forceActiveFocus(); }
|
||||
anchors {
|
||||
top: allButtons.bottom;
|
||||
left: parent.left;
|
||||
|
@ -103,54 +104,57 @@ Window {
|
|||
id: listView
|
||||
clip: true
|
||||
anchors { fill: parent; margins: 0 }
|
||||
|
||||
model: runningScriptsModel
|
||||
|
||||
delegate: Rectangle {
|
||||
id: rectangle
|
||||
clip: true
|
||||
radius: 3
|
||||
delegate: FocusScope {
|
||||
id: scope
|
||||
anchors { left: parent.left; right: parent.right }
|
||||
|
||||
height: scriptName.height + 12 + (ListView.isCurrentItem ? scriptName.height + 6 : 0)
|
||||
color: ListView.isCurrentItem ? "#39f" :
|
||||
index % 2 ? "#ddd" : "#eee"
|
||||
|
||||
Text {
|
||||
id: scriptName
|
||||
anchors { left: parent.left; leftMargin: 4; top: parent.top; topMargin:6 }
|
||||
text: name
|
||||
}
|
||||
|
||||
Text {
|
||||
id: scriptUrl
|
||||
anchors { left: scriptName.left; right: parent.right; rightMargin: 4; top: scriptName.bottom; topMargin: 6 }
|
||||
text: url
|
||||
elide: Text.ElideMiddle
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
Keys.onDownPressed: listView.incrementCurrentIndex()
|
||||
Keys.onUpPressed: listView.decrementCurrentIndex()
|
||||
Rectangle {
|
||||
id: rectangle
|
||||
anchors.fill: parent
|
||||
onClicked: listView.currentIndex = index
|
||||
}
|
||||
clip: true
|
||||
radius: 3
|
||||
color: scope.ListView.isCurrentItem ? "#79f" :
|
||||
index % 2 ? "#ddd" : "#eee"
|
||||
|
||||
Row {
|
||||
anchors.verticalCenter: scriptName.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
spacing: 4
|
||||
HifiControls.FontAwesome {
|
||||
text: "\uf021"; size: scriptName.height;
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: reloadScript(model.url)
|
||||
}
|
||||
Text {
|
||||
id: scriptName
|
||||
anchors { left: parent.left; leftMargin: 4; top: parent.top; topMargin:6 }
|
||||
text: name
|
||||
}
|
||||
HifiControls.FontAwesome {
|
||||
size: scriptName.height; text: "\uf00d"
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: stopScript(model.url)
|
||||
|
||||
Text {
|
||||
id: scriptUrl
|
||||
anchors { left: scriptName.left; right: parent.right; rightMargin: 4; top: scriptName.bottom; topMargin: 6 }
|
||||
text: url
|
||||
elide: Text.ElideMiddle
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: { listView.currentIndex = index; scope.forceActiveFocus(); }
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.verticalCenter: scriptName.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
spacing: 4
|
||||
HifiControls.FontAwesome {
|
||||
text: "\uf021"; size: scriptName.height;
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: reloadScript(model.url)
|
||||
}
|
||||
}
|
||||
HifiControls.FontAwesome {
|
||||
size: scriptName.height; text: "\uf00d"
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: stopScript(model.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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?
|
||||
|
@ -258,14 +262,14 @@ Window {
|
|||
console.log("Desktop size " + Qt.size(desktop.width, desktop.height));
|
||||
}
|
||||
|
||||
TableViewColumn {
|
||||
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
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue