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