From 03f30f628160670ad667de3a580510b0008ca5fa Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Mon, 4 Jun 2018 18:37:43 +0200 Subject: mobile: delay combobox selection for download. Set index of comboboxes in Download screen when the page becomes visible instead of when it is created. The pages is created before QBluetoothDeviceDiscoveryAgent on iOS and desktop, therefore combobox indexes cannot be set during page creation. Signed-off-by: Jan Iversen --- mobile-widgets/qml/DownloadFromDiveComputer.qml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index 268a2aa69..8ee898014 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -67,12 +67,11 @@ Kirigami.Page { } columns: 2 Controls.Label { text: qsTr(" Vendor name: ") } - property var vendoridx: downloadThread.data().getDetectedVendorIndex() Controls.ComboBox { id: comboVendor Layout.fillWidth: true model: vendorList - currentIndex: parent.vendoridx + currentIndex: -1 delegate: Controls.ItemDelegate { width: comboVendor.width contentItem: Text { @@ -100,10 +99,9 @@ Kirigami.Page { Controls.Label { text: qsTr(" Dive Computer:") } Controls.ComboBox { id: comboProduct - property var productidx: downloadThread.data().getDetectedProductIndex(comboVendor.currentText) Layout.fillWidth: true model: null - currentIndex: productidx + currentIndex: -1 delegate: Controls.ItemDelegate { width: comboProduct.width contentItem: Text { @@ -305,5 +303,13 @@ Kirigami.Page { } } } + + onVisibleChanged: { + if (visible) { + comboVendor.currentIndex = downloadThread.data().getDetectedVendorIndex() + comboProduct.currentIndex = downloadThread.data().getDetectedProductIndex(comboVendor.currentText) + comboDevice.currentIndex = downloadThread.data().getMatchingAddress(comboVendor.currentText, comboProduct.currentText) + } + } } } -- cgit v1.2.3-70-g09d2