[settings] Another way of fixing the problem of overlapping in landscape

Don't hide anything, just make the context menu as wide as the associated
grid slot. Works quite nicely.
This commit is contained in:
Slava Monich 2020-11-17 20:17:33 +02:00
parent ed91f6a053
commit a8f4912409
2 changed files with 6 additions and 21 deletions

View file

@ -41,12 +41,13 @@ ComboBox {
property alias key: configuration.key property alias key: configuration.key
property alias defaultValue: configuration.defaultValue property alias defaultValue: configuration.defaultValue
property bool ready property bool ready
property alias menuActive: actionMenu.active
value: currentItem ? currentItem.text : "" value: currentItem ? currentItem.text : ""
menu: ContextMenu { menu: ContextMenu {
id: actionMenu id: actionMenu
x: 0
width: actionComboBox.width
readonly property int defaultIndex: 0 readonly property int defaultIndex: 0
MenuItem { MenuItem {
//: Combo box value for no action //: Combo box value for no action

View file

@ -239,6 +239,8 @@ Page {
menu: ContextMenu { menu: ContextMenu {
id: orientationMenu id: orientationMenu
x: 0
width: orientationComboBox.width
readonly property int defaultIndex: 0 readonly property int defaultIndex: 0
MenuItem { MenuItem {
readonly property int value: 0 readonly property int value: 0
@ -291,8 +293,8 @@ Page {
value: currentItem ? currentItem.valueText : "" value: currentItem ? currentItem.valueText : ""
readonly property int yBottom: y + Theme.itemSizeSmall readonly property int yBottom: y + Theme.itemSizeSmall
menu: ContextMenu { menu: ContextMenu {
id: layoutMenu x: 0
width: layoutComboBox.width
readonly property int defaultIndex: 0 readonly property int defaultIndex: 0
BooksDetailMenuItem { BooksDetailMenuItem {
//: Combo box value for dynamic page layout //: Combo box value for dynamic page layout
@ -384,13 +386,6 @@ Page {
//% "Prevent the display from blanking while reading the book." //% "Prevent the display from blanking while reading the book."
description: qsTrId("harbour-books-settings-page-keep_display_on_description") description: qsTrId("harbour-books-settings-page-keep_display_on_description")
onClicked: keepDisplayOn.value = !keepDisplayOn.value onClicked: keepDisplayOn.value = !keepDisplayOn.value
// Avoid overlapping:
readonly property int yBottom: y + height
opacity: (landscapeLayout && (orientationMenu.active || (layoutMenu.active && yBottom > layoutComboBox.yBottom))) ? 0.0 : 1.0
visible: opacity > 0
Behavior on opacity { FadeAnimation { } }
ConfigurationValue { ConfigurationValue {
id: keepDisplayOn id: keepDisplayOn
key: rootPath + "keepDisplayOn" key: rootPath + "keepDisplayOn"
@ -418,8 +413,6 @@ Page {
width: parent.columnWidth width: parent.columnWidth
BooksActionSelector { BooksActionSelector {
id: volumeUpSelector
//: Combo box label //: Combo box label
//% "Volume up" //% "Volume up"
label: qsTrId("harbour-books-settings-page-volume_up-label") label: qsTrId("harbour-books-settings-page-volume_up-label")
@ -428,8 +421,6 @@ Page {
} }
BooksActionSelector { BooksActionSelector {
id: volumeDownSelector
//: Combo box label //: Combo box label
//% "Volume down" //% "Volume down"
label: qsTrId("harbour-books-settings-page-volume_down-label") label: qsTrId("harbour-books-settings-page-volume_down-label")
@ -450,13 +441,6 @@ Page {
//% "Tapping near the left edge of the screen returns to the previous page, tapping near the right edge gets you to the next page." //% "Tapping near the left edge of the screen returns to the previous page, tapping near the right edge gets you to the next page."
description: qsTrId("harbour-books-settings-page-turn_pages_by_tap-description") description: qsTrId("harbour-books-settings-page-turn_pages_by_tap-description")
onClicked: turnPageByTap.value = !turnPageByTap.value onClicked: turnPageByTap.value = !turnPageByTap.value
// Avoid overlapping:
readonly property int yBottom: y + height
opacity: (landscapeLayout && (volumeUpSelector.menuActive || (volumeDownSelector.menuActive && yBottom > volumeDownSelector.yBottom))) ? 0.0 : 1.0
visible: opacity > 0
Behavior on opacity { FadeAnimation { } }
ConfigurationValue { ConfigurationValue {
id: turnPageByTap id: turnPageByTap
key: rootPath + "turnPageByTap" key: rootPath + "turnPageByTap"