Qt 6.11 is out! See what's new in the release
blog
The QML Settings property alias trick with a button group
-
I'm able to easily created persist text field settings using
Settings { property alias my_setting: my_setting_field.text } TextField { id: my_setting_field }I now need a setting that takes one of a set of possible values. I tried something like this
Settings { property alias my_setting: my_setting_group.checkedButton._value } ButtonGroup { id: my_setting_group } Button { text: "option 1" property string _value: "option_1" checked: app_settings.my_setting === _value ButtonGroup.group: my_setting_group } Button { text: "option 2" property string _value: "option_2" checked: app_settings.my_setting === _value ButtonGroup.group: my_setting_group }and a few variations but couldn't get anything to work. Also, I would like a way to choose the default checked button when the app starts for the first time.