[app] Make pulley menus initially invisible
They will be made visible by BooksMainPage when needed.
This commit is contained in:
parent
b74d57291c
commit
6c2354d2e5
3 changed files with 16 additions and 10 deletions
|
@ -134,6 +134,8 @@ Item {
|
|||
PullDownMenu {
|
||||
id: menu
|
||||
|
||||
visible: false // BooksMainPage will make it visible when it's needed
|
||||
|
||||
MenuItem {
|
||||
//: Pulley menu item
|
||||
//% "Settings"
|
||||
|
|
|
@ -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) {
|
||||
if (flickable.pullDownMenu !== menu) {
|
||||
if (flickable.pullDownMenu) {
|
||||
flickable.pullDownMenu.visible = false
|
||||
}
|
||||
function updatePullDownMenu() {
|
||||
var menu = currentView ? currentView.pullDownMenu : null
|
||||
if (menu) {
|
||||
menu.visible = true
|
||||
}
|
||||
if (flickable.pullDownMenu !== menu) {
|
||||
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
|
||||
|
|
|
@ -96,6 +96,8 @@ Item {
|
|||
PullDownMenu {
|
||||
id: menu
|
||||
|
||||
visible: false // BooksMainPage will make it visible when it's needed
|
||||
|
||||
MenuItem {
|
||||
//: Pulley menu item
|
||||
//% "Settings"
|
||||
|
|
Loading…
Reference in a new issue