qml settings overwritten on startup
Unsolved
QML and Qt Quick
-
Hi,
I have a programm thats making serial communication w/ modbus
I want to store the selected comport with qml settings .
With this im storing the settings:Settings { property alias serialPortName: serialName.currentText }
And this is the combobox:
ComboBox { id: serialName width: 200 model: Serial.portsNames }
After startup the property is overwritten by the first entry in the model. Any ideas how to fix this?
Thanks in advance -
@Slash200 The currentText property of ComboBox (Controls1 or 2) is read-only, it's probably the reason why it's not updated by Settings. Try currentIndex. It has a drawback that if the model is changed between the application version upgrades or dynamically between sessions it gives the wrong index. But it's difficult to handle versioning with Settings for anything, I think.