From a8f4912409cd36bb2ddca28f0f7465644cd5a069 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Tue, 17 Nov 2020 20:17:33 +0200 Subject: [PATCH] [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. --- app/settings/BooksActionSelector.qml | 3 ++- app/settings/BooksSettings.qml | 24 ++++-------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/settings/BooksActionSelector.qml b/app/settings/BooksActionSelector.qml index 573d694..e26202e 100644 --- a/app/settings/BooksActionSelector.qml +++ b/app/settings/BooksActionSelector.qml @@ -41,12 +41,13 @@ ComboBox { property alias key: configuration.key property alias defaultValue: configuration.defaultValue property bool ready - property alias menuActive: actionMenu.active value: currentItem ? currentItem.text : "" menu: ContextMenu { id: actionMenu + x: 0 + width: actionComboBox.width readonly property int defaultIndex: 0 MenuItem { //: Combo box value for no action diff --git a/app/settings/BooksSettings.qml b/app/settings/BooksSettings.qml index 2bdcb01..36fd2b8 100644 --- a/app/settings/BooksSettings.qml +++ b/app/settings/BooksSettings.qml @@ -239,6 +239,8 @@ Page { menu: ContextMenu { id: orientationMenu + x: 0 + width: orientationComboBox.width readonly property int defaultIndex: 0 MenuItem { readonly property int value: 0 @@ -291,8 +293,8 @@ Page { value: currentItem ? currentItem.valueText : "" readonly property int yBottom: y + Theme.itemSizeSmall menu: ContextMenu { - id: layoutMenu - + x: 0 + width: layoutComboBox.width readonly property int defaultIndex: 0 BooksDetailMenuItem { //: Combo box value for dynamic page layout @@ -384,13 +386,6 @@ Page { //% "Prevent the display from blanking while reading the book." description: qsTrId("harbour-books-settings-page-keep_display_on_description") 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 { id: keepDisplayOn key: rootPath + "keepDisplayOn" @@ -418,8 +413,6 @@ Page { width: parent.columnWidth BooksActionSelector { - id: volumeUpSelector - //: Combo box label //% "Volume up" label: qsTrId("harbour-books-settings-page-volume_up-label") @@ -428,8 +421,6 @@ Page { } BooksActionSelector { - id: volumeDownSelector - //: Combo box label //% "Volume down" 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." description: qsTrId("harbour-books-settings-page-turn_pages_by_tap-description") 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 { id: turnPageByTap key: rootPath + "turnPageByTap"