diff options
author | jan Iversen <jani@libreoffice.org> | 2018-06-04 18:37:43 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-06-04 10:27:13 -0700 |
commit | 03f30f628160670ad667de3a580510b0008ca5fa (patch) | |
tree | fb0ca27d700405df8144e1a360346c89a7ce8483 /mobile-widgets/qml | |
parent | 36b9e5e31eca0354f9ad277fb668c3846714b81e (diff) | |
download | subsurface-03f30f628160670ad667de3a580510b0008ca5fa.tar.gz |
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 <jani@apache.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/DownloadFromDiveComputer.qml | 14 |
1 files changed, 10 insertions, 4 deletions
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) + } + } } } |