From 3a7c2d83f5dabe45742b65b49bb37993c3ef88c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 29 Sep 2024 18:46:49 -1000 Subject: [PATCH] Move `PullDownMenu` into the `SilicaListView` A `SilicaListView` will properly handle a child `PullDownMenu`. It was previously working when it was the child of a `SilicaFlickable`, but since it was replaced by a `Column` it was not usable anymore. Attaching the `PullDownMenu` to the `SilicaListView` instead of the `SilicaFlickable`, it is properly hidden when the list of OTP is scroll down and the menu cannot be operated by scrolling down. --- qml/pages/MainView.qml | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/qml/pages/MainView.qml b/qml/pages/MainView.qml index 0f53dab..81d9150 100644 --- a/qml/pages/MainView.qml +++ b/qml/pages/MainView.qml @@ -104,33 +104,32 @@ Page { Column { anchors.fill: parent - PullDownMenu { - MenuItem { - text: qsTr("About") - onClicked: pageStack.push(Qt.resolvedUrl("About.qml")) - } - MenuItem { - text: qsTr("Settings") - visible: true - onClicked: pageStack.push(Qt.resolvedUrl("Settings.qml")) - } - MenuItem { - text: qsTr("Export / Import") - onClicked: pageStack.push(Qt.resolvedUrl("ExportPage.qml"), {parentPage: mainPage, mode: "export"}) - } - MenuItem { - text: qsTr("Add Token") - onClicked: pageStack.push(Qt.resolvedUrl("ScanOTP.qml"), {parentPage: mainPage}) - } - } - - SilicaListView { id: otpList model: appWin.listModel height: parent.height - updateProgress.height - searchField.height width: parent.width + PullDownMenu { + MenuItem { + text: qsTr("About") + onClicked: pageStack.push(Qt.resolvedUrl("About.qml")) + } + MenuItem { + text: qsTr("Settings") + visible: true + onClicked: pageStack.push(Qt.resolvedUrl("Settings.qml")) + } + MenuItem { + text: qsTr("Export / Import") + onClicked: pageStack.push(Qt.resolvedUrl("ExportPage.qml"), {parentPage: mainPage, mode: "export"}) + } + MenuItem { + text: qsTr("Add Token") + onClicked: pageStack.push(Qt.resolvedUrl("ScanOTP.qml"), {parentPage: mainPage}) + } + } + ViewPlaceholder { enabled: otpList.count == 0 text: qsTr("Nothing here")