From f9eee882f718f1659c98638833155468ac50cbc6 Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Fri, 15 Nov 2024 14:37:09 +0100 Subject: [PATCH] Use background property for BusyIndicator to make it work with kirigami --- .../platform.qtcontrols/BusyIndicatorPL.qml | 2 ++ .../components/platform.silica/PageListPL.qml | 8 ++++++++ ui/qml/pages/PairPage.qml | 19 +++++++++++-------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ui/qml/components/platform.qtcontrols/BusyIndicatorPL.qml b/ui/qml/components/platform.qtcontrols/BusyIndicatorPL.qml index e3b93529..3c52bd29 100644 --- a/ui/qml/components/platform.qtcontrols/BusyIndicatorPL.qml +++ b/ui/qml/components/platform.qtcontrols/BusyIndicatorPL.qml @@ -23,5 +23,7 @@ import QtQuick.Layouts 1.12 BusyIndicator { Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter // anchors.centerIn: parent + height: styler.themeFontSizeHuge + width: height } diff --git a/ui/qml/components/platform.silica/PageListPL.qml b/ui/qml/components/platform.silica/PageListPL.qml index 60ea5161..71ecca31 100644 --- a/ui/qml/components/platform.silica/PageListPL.qml +++ b/ui/qml/components/platform.silica/PageListPL.qml @@ -35,12 +35,20 @@ Page { property alias pageMenu: menuLoader.sourceComponent property alias placeholderEnabled: viewPlaceholder.enabled property alias placeholderText: viewPlaceholder.hintText + property alias background: backgroundLoader.sourceComponent property string title signal pageStatusActivating signal pageStatusActive signal pageStatusInactive + + Loader { + id: backgroundLoader + active: sourceComponent ? true : false + anchors.centerIn: parent + } + SilicaListView { id: listView anchors.fill: parent diff --git a/ui/qml/pages/PairPage.qml b/ui/qml/pages/PairPage.qml index d5ad4b56..63d328a8 100644 --- a/ui/qml/pages/PairPage.qml +++ b/ui/qml/pages/PairPage.qml @@ -10,12 +10,13 @@ PageListPL { //backNavigation: !DaemonInterfaceInstance.pairing title: qsTr("Pair Device") - placeholderText: _placeholderText || qsTr("No devices found") - placeholderEnabled: devicesModel.rowCount() > 0 + placeholderText: qsTr("No devices found") + placeholderEnabled: (delegateModel.count === 0) && !busy + property bool busy: (adapter && adapter.discovering && !page.count) || DaemonInterfaceInstance.connectionState == "pairing" + //busy: discoveryModel.running || DaemonInterfaceInstance.pairing property string deviceType property variant aliases - property string _placeholderText property string _deviceName property string _deviceAddress property QtObject adapter: _bluetoothManager ? _bluetoothManager.usableAdapter : null @@ -156,7 +157,7 @@ PageListPL { } // Set to undefined when pairing to show busy indicator only - model: !DaemonInterfaceInstance.pairing && !_placeholderText + model: (DaemonInterfaceInstance !== undefined) && !DaemonInterfaceInstance.pairing && delegateModel.count > 0 ? delegateModel : undefined @@ -165,13 +166,12 @@ PageListPL { //busy: discoveryModel.running || DaemonInterfaceInstance.pairing PageMenuItemPL { - enabled: !DaemonInterfaceInstance.pairing + enabled: (DaemonInterfaceInstance !== undefined) && !DaemonInterfaceInstance.pairing iconSource: adapter && adapter.discovering ? "" : (styler.iconDeviceScan !== undefined ? styler.iconDeviceScan : "") text: adapter && adapter.discovering ? qsTr("Stop scanning") : qsTr("Scan for devices") onClicked: { - _placeholderText = "" if (adapter && adapter.discovering) { stopDiscovery(); } else { @@ -191,10 +191,13 @@ PageListPL { } } - BusyIndicatorPL { + background: BusyIndicatorPL { id: busyIndicator anchors.centerIn: parent - running: (adapter && adapter.discovering && !page.count) || DaemonInterfaceInstance.connectionState == "pairing" + running: busy } + + + }