QButtonGroup difficulty
-
Hi, All!
Please help me with QButtonGroup.Suppose on my Qtcreator form I have (for instance) 50 radiobuttons united in one QButtonGroup
When I quit my app I memories the active radiobutton index as an integer value in an ini file.When I ran my app again I read the saved index value for an ini file, and I wish to restore QButtonGroup status as it was before quitting.
But how on earth I can do it?
-
@qAlexKo
By "active" radiobutton do you mean the one radiobutton which is selected in a group of 50 exclusives?checkedId()
returns the id of the selected button.QButtonGroup::button(int id)
returns the button with that id, to refind it at a later date. And probablyQAbstractButton::click()
can be used to click that button to reselect it when you restore, or maybe it'ssetChecked(true)
.https://gist.github.com/mistic100/dcbffbd9e9c15271dd14 seems to set the checked button. It does it by iterating every button for its
id
, I thinkQButtonGroup::button(int id)
can be used to save you having to find it. -
@JonB said in QButtonGroup difficulty:
https://gist.github.com/mistic100/dcbffbd9e9c15271dd14 seems to set the checked button. It does it by iterating every button f
OK it is a way out, thanx, although for me it is very strange that QGroupButton offers Checkedid() function to get the active button ID, and it can't set up the active button by a known ID. ;-)
-