PDA

View Full Version : Quick question - Ways to change IDs of a buttons in a QButtonGroup



Dangelo
9th October 2013, 23:52
Hello guys, is pretty much just the title
To rearrange buttons in a QButtonGroup the only way I found was to re-add one by one, like
ExampleGroupButton->addButton(ExampleGroupButton->button(i),i-1)

Is there any other easier way to change the ID if a button in a QGroupButton?
thanks in advance

ChrisW67
10th October 2013, 00:12
QButtonGroup::setId() seems fairly obvious in the documentation.

If you want to maintain contiguous ids after removing a button, as your example suggests, then iterating over the buttons or moving the highest id button into the gap are your options. I don't know why you would want to do this.

Dangelo
14th October 2013, 23:43
Omg, i'm very embarrassed, sorry for the silly question...
Thanxs anyway!