View Full Version : QRadioButton

8th October 2007, 07:11
I have a QRadioButton in my program. I need to call a function named " ClickedSize(int) " when i click on that option button. So I connect that RadioButton like this,

connect( SubQCIFRadioButton, SIGNAL( toggled(bool) ), this, SLOT( ClickedSize(int) ) );

but, when I run my program, a message is display like this,
================================================== =
QObject::connect: Incompatible sender/receiver arguments QRadioButton::toggled(bool) --> CVideoSettings::ClickedSize(int)
================================================== ==

why this error? please help me

8th October 2007, 07:25
you just want to enable the button?
than try
connect( SubQCIFRadioButton, SIGNAL( toggled(bool) ), this, SLOT( setEnabled(bool) ) );
because you call a SIGNAL with a bool parameter for a SLOT with a int parameter. these types are incompatible.

8th October 2007, 07:38
I need to run a function when I click on the Radiobutton.
When I use like this,
connect( SubQCIFRadioButton, SIGNAL( clicked(int) ), this, SLOT( ClickedSize(int) ) );

it display anothr message
Object::connect: No such signal QRadioButton::clicked(int)
Object::connect: (sender name: 'SubQCIFRadioButton')

8th October 2007, 08:25
You want to call the function ClickedSize(int). But what value do you want the int parameter to have? Qt can't guess this for you. That's why it expects the signal to have compatible argument types, to pass this information on to the slot.

As for the second error message, there simply is no clicked(int) signal.

I guess you want to call ClickedSize with a fixed argument. Create a new slot that takes no arguments and calls ClickedSize with the value you need. Connect the clicked() signal to that slot.