From c93d8bc31c32d1febea9dd1736b1a3cc8cf928a5 Mon Sep 17 00:00:00 2001 From: DavidLazarescu Date: Fri, 29 Mar 2024 15:34:02 +0100 Subject: [PATCH] Fixes #158 --- .../CustomComponents/comboBox/MComboBox.qml | 2 ++ .../readingToolbar/MReadingToolBar.qml | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/presentation/modules/CustomComponents/comboBox/MComboBox.qml b/src/presentation/modules/CustomComponents/comboBox/MComboBox.qml index b6db08321..24c419370 100644 --- a/src/presentation/modules/CustomComponents/comboBox/MComboBox.qml +++ b/src/presentation/modules/CustomComponents/comboBox/MComboBox.qml @@ -215,11 +215,13 @@ Item { function setDefaultItem(itemName) { for (var i = 0; i < selectionPopup.model.count; i++) { if (selectionPopup.model.get(i)[contentPropertyName] === itemName) { + print("Found at index: " + i) selectItem(i) return } } + selectionPopup.listView.currentIndex = -1 selectionPopup.defaultIndex = -1 } diff --git a/src/presentation/readingPage/readingToolbar/MReadingToolBar.qml b/src/presentation/readingPage/readingToolbar/MReadingToolBar.qml index 7e8f76632..b427f96ad 100644 --- a/src/presentation/readingPage/readingToolbar/MReadingToolBar.qml +++ b/src/presentation/readingPage/readingToolbar/MReadingToolBar.qml @@ -270,10 +270,20 @@ Pane { Component.onCompleted: zoomAssignment.start() Timer { id: zoomAssignment + property int firstTime: 0 + interval: 5 - onTriggered: zoomComboBox.text = Qt.binding(function () { - return Math.round(BookController.zoom * 100) + "%" - }) + onTriggered: { + zoomComboBox.text = Qt.binding(function () { + return Math.round(BookController.zoom * 100) + "%" + }) + + // Only wanna do this the first time + if (firstTime == 0) { + zoomComboBox.setDefaultItem(zoomComboBox.text) + firstTime++ + } + } } // Remove % sign from text