From 6c2354d2e57baedf4be71e79a4309f5b8988152b Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Mon, 2 Nov 2020 02:06:57 +0200 Subject: [PATCH] [app] Make pulley menus initially invisible They will be made visible by BooksMainPage when needed. --- app/qml/BooksBookView.qml | 2 ++ app/qml/BooksMainPage.qml | 22 ++++++++++++---------- app/qml/BooksStorageView.qml | 2 ++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/qml/BooksBookView.qml b/app/qml/BooksBookView.qml index d4785e0..98ecd06 100644 --- a/app/qml/BooksBookView.qml +++ b/app/qml/BooksBookView.qml @@ -134,6 +134,8 @@ Item { PullDownMenu { id: menu + visible: false // BooksMainPage will make it visible when it's needed + MenuItem { //: Pulley menu item //% "Settings" diff --git a/app/qml/BooksMainPage.qml b/app/qml/BooksMainPage.qml index 06cb593..85d9603 100644 --- a/app/qml/BooksMainPage.qml +++ b/app/qml/BooksMainPage.qml @@ -47,23 +47,26 @@ Page { Component.onCompleted: createBookViewIfNeeded() - onCurrentViewChanged: setPullDownMenu(currentView ? currentView.pullDownMenu : null) + onCurrentViewChanged: updatePullDownMenu() function createBookViewIfNeeded() { if (Settings.currentBook && !bookView) { bookView = bookViewComponent.createObject(flickable.contentItem) + updatePullDownMenu() } } - function setPullDownMenu(menu) { + function updatePullDownMenu() { + var menu = currentView ? currentView.pullDownMenu : null + if (menu) { + menu.visible = true + } if (flickable.pullDownMenu !== menu) { - if (flickable.pullDownMenu) { - flickable.pullDownMenu.visible = false - } - if (menu) { - menu.visible = true - } + var prevMenu = flickable.pullDownMenu flickable.pullDownMenu = menu + if (prevMenu) { + prevMenu.visible = false + } } } @@ -74,7 +77,7 @@ Page { Connections { target: currentView - onPullDownMenuChanged: setPullDownMenu(currentView.pullDownMenu) + onPullDownMenuChanged: updatePullDownMenu() } SilicaFlickable { @@ -83,7 +86,6 @@ Page { anchors.fill: parent flickableDirection: Flickable.VerticalFlick interactive: currentView && currentView.viewInteractive - pullDownMenu: currentView ? currentView.pullDownMenu : null BooksStorageView { id: storageView diff --git a/app/qml/BooksStorageView.qml b/app/qml/BooksStorageView.qml index fe12f92..d1ec6d3 100644 --- a/app/qml/BooksStorageView.qml +++ b/app/qml/BooksStorageView.qml @@ -96,6 +96,8 @@ Item { PullDownMenu { id: menu + visible: false // BooksMainPage will make it visible when it's needed + MenuItem { //: Pulley menu item //% "Settings"