PDA

View Full Version : QButtonGroup::setButton(int) conversion



JimBrown
8th March 2007, 15:00
Hello,

I can't find how to convert the Qt3 method QButtonGroup::setButton(int) to Qt4. Qt3 docs say that it "Sets the selected toggle button to id." I'm looking at QButtonGroup topic in the Assistant, but I can't find what I want. In the "Porting to Qt 4" document they have the confusing entry:

void QButtonGroup::setButton(int) Setter.

without saying what "Setter" is. I was hoping for an entry like "use clickButton" instead.

Thank you.

wysota
8th March 2007, 15:04
I think QButtonGroup::setId() is what you're after.

Oh, and "setter" is a "method that sets a value" contrary to a "getter" which is a "method that gets a value".

JimBrown
8th March 2007, 15:27
I think QButtonGroup::setId() is what you're after.

Oh, and "setter" is a "method that sets a value" contrary to a "getter" which is a "method that gets a value".

Thanks for the quick reply. I think that the value I want to set is "which button in a button group is now toggled."

setId sets the id for a specified button, but it doesn't set a particular button in a group as clicked.

wysota
8th March 2007, 15:51
I see... in that case use QAbstractButton::setChecked(true) on the button you want to be pressed.

JimBrown
8th March 2007, 16:08
I see... in that case use QAbstractButton::setChecked(true) on the button you want to be pressed.

Got it. Thank you.