Support back and forward buttons.
This commit is contained in:
parent
821a05d067
commit
da6b21ca6d
3 changed files with 31 additions and 0 deletions
|
@ -65,6 +65,8 @@ GridView {
|
||||||
property bool scrollDown: false
|
property bool scrollDown: false
|
||||||
|
|
||||||
signal keyPress(var event)
|
signal keyPress(var event)
|
||||||
|
signal backPress()
|
||||||
|
signal forwardPress()
|
||||||
|
|
||||||
cacheBuffer: Math.max(0, control.height * 1.5)
|
cacheBuffer: Math.max(0, control.height * 1.5)
|
||||||
reuseItems: true
|
reuseItems: true
|
||||||
|
@ -469,6 +471,13 @@ GridView {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
clearPressState()
|
clearPressState()
|
||||||
|
|
||||||
|
if (mouse.buttons & Qt.BackButton) {
|
||||||
|
control.backPress()
|
||||||
|
}
|
||||||
|
if (mouse.buttons & Qt.ForwardButton){
|
||||||
|
control.forwardPress()
|
||||||
|
}
|
||||||
|
|
||||||
if (mouse.buttons & Qt.RightButton) {
|
if (mouse.buttons & Qt.RightButton) {
|
||||||
dirModel.openContextMenu(null, mouse.modifiers)
|
dirModel.openContextMenu(null, mouse.modifiers)
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,8 @@ ListView {
|
||||||
property variant cachedRectangleSelection: null
|
property variant cachedRectangleSelection: null
|
||||||
|
|
||||||
signal keyPress(var event)
|
signal keyPress(var event)
|
||||||
|
signal backPress()
|
||||||
|
signal forwardPress()
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
cacheBuffer: width
|
cacheBuffer: width
|
||||||
|
@ -288,12 +290,20 @@ ListView {
|
||||||
dirModel.openContextMenu(null, mouse.modifiers)
|
dirModel.openContextMenu(null, mouse.modifiers)
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
clearPressState()
|
clearPressState()
|
||||||
|
|
||||||
|
if (mouse.buttons & Qt.BackButton) {
|
||||||
|
control.backPress()
|
||||||
|
}
|
||||||
|
if (mouse.buttons & Qt.ForwardButton){
|
||||||
|
control.forwardPress()
|
||||||
|
}
|
||||||
|
|
||||||
if (!hoveredItem || hoveredItem.blank || control.currentIndex === -1 || control.ctrlPressed
|
if (!hoveredItem || hoveredItem.blank || control.currentIndex === -1 || control.ctrlPressed
|
||||||
|| control.shiftPressed) {
|
|| control.shiftPressed) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -337,6 +337,12 @@ Item {
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
_fileTips.visible = count === 0
|
_fileTips.visible = count === 0
|
||||||
}
|
}
|
||||||
|
onForwardPressed: {
|
||||||
|
dirModel.goForward();
|
||||||
|
}
|
||||||
|
onBackPressed:{
|
||||||
|
dirModel.goBack();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,6 +362,12 @@ Item {
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
_fileTips.visible = count === 0
|
_fileTips.visible = count === 0
|
||||||
}
|
}
|
||||||
|
onForwardPressed: {
|
||||||
|
dirModel.goForward();
|
||||||
|
}
|
||||||
|
onBackPressed:{
|
||||||
|
dirModel.goBack();
|
||||||
|
}
|
||||||
|
|
||||||
delegate: FolderListItem {}
|
delegate: FolderListItem {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue