Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Save in QSettings the current checked button of a groubbox..
Leon last edited by
How is it possible?
@settings.setValue("current_page" , ui->buttonGroup->checkedButton()); ui->buttonGroup->button(settings.value("current_page",true).toInt())->setChecked();@
won't work cause ui->buttonGroup->checkedButton() is a QAbstactButton and not an int.
ChrisW67 last edited by
Firstly, a QButtonGroup is not a QGroupBox, so your title is misleading.
QButtonGroup::checkedId() gives you the id number you associated with the button that is currently checked: store this. You can use that to find the button to check, using QButtonGroup::id(), when you retrieve the value from QSettings.