Fix popups not being flickable by keyboard
This commit is contained in:
parent
e45055f48c
commit
e9af47e1c7
|
@ -15,7 +15,7 @@ HPage {
|
|||
property alias flickShortcuts: flickShortcuts
|
||||
|
||||
property bool enableFlickShortcuts:
|
||||
SwipeView ? SwipeView.isCurrentItem : true
|
||||
SwipeView && SwipeView.view ? SwipeView.isCurrentItem : true
|
||||
|
||||
implicitWidth: theme.controls.box.defaultWidth
|
||||
implicitHeight: contentHeight + implicitHeaderHeight + implicitFooterHeight
|
||||
|
|
|
@ -6,7 +6,8 @@ import QtQuick 2.12
|
|||
Shortcut {
|
||||
// TODO: use enabled + a Binding with restoreValue when switch to Qt 5.15
|
||||
property bool active: true
|
||||
property bool disableIfAnyPopupOrMenu: true
|
||||
|
||||
enabled: ! window.anyPopupOrMenu && active
|
||||
enabled: (! window.anyPopupOrMenu || ! disableIfAnyPopupOrMenu) && active
|
||||
context: Qt.ApplicationShortcut
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ HPopup {
|
|||
popup.maximumPreferredHeight,
|
||||
implicitHeaderHeight + implicitFooterHeight + contentHeight,
|
||||
)
|
||||
flickShortcuts.disableIfAnyPopupOrMenu: false
|
||||
|
||||
Keys.onReturnPressed: popup.keyboardAccept()
|
||||
Keys.onEnterPressed: popup.keyboardAccept()
|
||||
|
|
|
@ -9,39 +9,46 @@ HQtObject {
|
|||
|
||||
property Item flickable: parent
|
||||
property bool active: true
|
||||
property bool disableIfAnyPopupOrMenu: true
|
||||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.Scrolling.up
|
||||
onActivated: utils.flickPages(flickable, -1 / 10)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.Scrolling.down
|
||||
onActivated: utils.flickPages(flickable, 1 / 10)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.Scrolling.page_up
|
||||
onActivated: utils.flickPages(flickable, -1)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.Scrolling.page_down
|
||||
onActivated: utils.flickPages(flickable, 1)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.Scrolling.top
|
||||
onActivated: utils.flickToTop(flickable)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.Scrolling.bottom
|
||||
onActivated: utils.flickToBottom(flickable)
|
||||
}
|
||||
|
|
|
@ -9,9 +9,11 @@ HQtObject {
|
|||
|
||||
property Item container: parent
|
||||
property bool active: container.count > 1
|
||||
property bool disableIfAnyPopupOrMenu: true
|
||||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.previous_tab
|
||||
onActivated: container.setCurrentIndex(
|
||||
utils.numberWrapAt(container.currentIndex - 1, container.count),
|
||||
|
@ -20,6 +22,7 @@ HQtObject {
|
|||
|
||||
HShortcut {
|
||||
active: root.active
|
||||
disableIfAnyPopupOrMenu: root.disableIfAnyPopupOrMenu
|
||||
sequences: window.settings.Keys.next_tab
|
||||
onActivated: container.setCurrentIndex(
|
||||
utils.numberWrapAt(container.currentIndex + 1, container.count),
|
||||
|
|
Loading…
Reference in New Issue
Block a user