fix(filemanager): update QML input handlers

main
reionwong 3 weeks ago
parent 30ff8ca4a8
commit 0651f23e76

@ -64,8 +64,10 @@ FishUI.Window {
control.close()
}
Keys.enabled: true
Keys.onEscapePressed: control.close()
Shortcut {
sequence: "Escape"
onActivated: control.close()
}
ColumnLayout {
id: _mainLayout

@ -41,8 +41,10 @@ FishUI.Window {
maximumWidth: widthValue
maximumHeight: heightValue
Keys.enabled: true
Keys.onEscapePressed: control.close()
Shortcut {
sequence: "Escape"
onActivated: control.close()
}
background.color: FishUI.Theme.secondBackgroundColor

@ -197,7 +197,7 @@ GridView {
highlightMoveDuration: 0
keyNavigationEnabled : true
keyNavigationWraps : true
Keys.onPressed: {
Keys.onPressed: function(event) {
control.keyPress(event)
if (event.key === Qt.Key_Control) {
@ -213,7 +213,7 @@ GridView {
control.decreaseIconSize()
}
}
Keys.onReleased: {
Keys.onReleased: function(event) {
if (event.key === Qt.Key_Control) {
ctrlPressed = false
} else if (event.key === Qt.Key_Shift) {
@ -221,13 +221,13 @@ GridView {
anchorIndex = 0
}
}
Keys.onEscapePressed: {
Keys.onEscapePressed: function(event) {
if (!editor || !editor.targetItem) {
dirModel.clearSelection()
event.accepted = false
}
}
Keys.onUpPressed: {
Keys.onUpPressed: function(event) {
if (!editor || !editor.targetItem) {
var newIndex = positioner.nearestItem(currentIndex,
effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.UpArrow))
@ -237,7 +237,7 @@ GridView {
}
}
}
Keys.onDownPressed: {
Keys.onDownPressed: function(event) {
if (!editor || !editor.targetItem) {
var newIndex = positioner.nearestItem(currentIndex,
effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.DownArrow))
@ -247,7 +247,7 @@ GridView {
}
}
}
Keys.onLeftPressed: {
Keys.onLeftPressed: function(event) {
if (!editor || !editor.targetItem) {
var newIndex = positioner.nearestItem(currentIndex,
effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.LeftArrow))
@ -257,7 +257,7 @@ GridView {
}
}
}
Keys.onRightPressed: {
Keys.onRightPressed: function(event) {
if (!editor || !editor.targetItem) {
var newIndex = positioner.nearestItem(currentIndex,
effectiveNavDirection(control.flow, control.effectiveLayoutDirection, Qt.RightArrow))
@ -332,7 +332,7 @@ GridView {
DragDrop.DropArea {
anchors.fill: parent
onDrop: {
onDrop: function(event) {
control.drop(control, event, mapToItem(control, event.x, event.y))
}
}
@ -347,7 +347,7 @@ GridView {
enabled: true
z: -1
onPressed: {
onPressed: function(mouse) {
control.forceActiveFocus()
if (control.editor && childAt(mouse.x, mouse.y) !== control.editor)
@ -403,7 +403,7 @@ GridView {
}
}
onPositionChanged: {
onPositionChanged: function(mouse) {
control.ctrlPressed = (mouse.modifiers & Qt.ControlModifier)
control.shiftPressed = (mouse.modifiers & Qt.ShiftModifier)
@ -483,7 +483,7 @@ GridView {
clearPressState()
}
onDoubleClicked: {
onDoubleClicked: function(mouse) {
if (mouse.button === Qt.LeftButton && control.pressedItem)
dirModel.openSelected()
}
@ -506,7 +506,7 @@ GridView {
onCanceled: pressCanceled()
onWheel: {
onWheel: function(wheel) {
if (wheel.modifiers & Qt.ControlModifier) {
if (wheel.angleDelta.y > 0)
control.increaseIconSize()
@ -676,7 +676,7 @@ GridView {
}
}
Keys.onPressed: {
Keys.onPressed: function(event) {
switch (event.key) {
case Qt.Key_Return:
case Qt.Key_Enter:

@ -143,7 +143,7 @@ ListView {
highlightMoveDuration: 0
Keys.enabled: true
Keys.onPressed: {
Keys.onPressed: function(event) {
control.keyPress(event)
if (event.key === Qt.Key_Control) {
@ -156,7 +156,7 @@ ListView {
}
}
Keys.onReleased: {
Keys.onReleased: function(event) {
if (event.key === Qt.Key_Control) {
ctrlPressed = false
} else if (event.key === Qt.Key_Shift) {
@ -165,14 +165,14 @@ ListView {
}
}
Keys.onEscapePressed: {
Keys.onEscapePressed: function(event) {
if (!editor || !editor.targetItem) {
dirModel.clearSelection()
event.accepted = false
}
}
Keys.onUpPressed: {
Keys.onUpPressed: function(event) {
if (!editor || !editor.targetItem) {
var newIndex = currentIndex
newIndex--;
@ -185,7 +185,7 @@ ListView {
}
}
Keys.onDownPressed: {
Keys.onDownPressed: function(event) {
if (!editor || !editor.targetItem) {
var newIndex = currentIndex
newIndex++
@ -227,7 +227,7 @@ ListView {
DragDrop.DropArea {
anchors.fill: parent
onDrop: {
onDrop: function(event) {
control.drop(control, event, mapToItem(control, event.x, event.y))
}
}
@ -242,12 +242,12 @@ ListView {
enabled: true
z: -1
onDoubleClicked: {
onDoubleClicked: function(mouse) {
if (mouse.button === Qt.LeftButton && control.pressedItem)
dirModel.openSelected()
}
onPressed: {
onPressed: function(mouse) {
control.forceActiveFocus()
if (control.editor && childAt(mouse.x, mouse.y) !== control.editor)
@ -316,7 +316,7 @@ ListView {
// TODO: rename
}
onPositionChanged: {
onPositionChanged: function(mouse) {
control.ctrlPressed = (mouse.modifiers & Qt.ControlModifier)
control.shiftPressed = (mouse.modifiers & Qt.ShiftModifier)
@ -497,7 +497,7 @@ ListView {
control.forceActiveFocus()
}
Keys.onPressed: {
Keys.onPressed: function(event) {
switch (event.key) {
case Qt.Key_Return:
case Qt.Key_Enter:

@ -57,12 +57,12 @@ Item {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onPressed: {
onPressed: function(mouse) {
_dragged = false
_pressX = mouse.x
_pressY = mouse.y
}
onPositionChanged: {
onPositionChanged: function(mouse) {
if (Math.abs(mouse.x - _pressX) > 4 || Math.abs(mouse.y - _pressY) > 4)
_dragged = true
}
@ -130,12 +130,12 @@ Item {
property real pressX: 0
property real pressY: 0
onPressed: {
onPressed: function(mouse) {
dragged = false
pressX = mouse.x
pressY = mouse.y
}
onPositionChanged: {
onPositionChanged: function(mouse) {
if (Math.abs(mouse.x - pressX) > 4 || Math.abs(mouse.y - pressY) > 4)
dragged = true
}
@ -191,7 +191,7 @@ Item {
closeEditor()
}
Keys.onPressed: {
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape)
focus = false
}

@ -101,7 +101,7 @@ ListView {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
onClicked: function(mouse) {
if (mouse.button === Qt.LeftButton) {
if (model.isDevice && model.setupNeeded)
placesModel.requestSetup(index)

Loading…
Cancel
Save