PDA

View Full Version : No such signal QRadioButton::toggled()



bpetty
14th August 2006, 23:59
The Title Says it all... "Object::connect: No such signal QRadioButton::toggled()"

I was looking through the docs on QRadioButton and it inherits:
void QAbstractButton::toggled ( bool checked ) [signal]

So I tried to create the following connection like so:


...
connect(ui.rbManualMode, SIGNAL(toggled()), this, SLOT(toggleManualTab()));
}

void ConfigurationForm::toggleManualTab()
{
bool bEnableTab = ui.rbManualMode->isChecked();

ui.twConfig->setTabEnabled( 1, bEnableTab );
}


I am trying to enable / dissable a tab based on a radio button choice. For some reason it can not send a toggled() signal. I must be missing something fundemental here because it seems too easy to mess up.

jacek
15th August 2006, 00:06
There is a toggled(bool) signal, not toggled().

Try:
connect( ui.rbManualMode, SIGNAL( toggled( bool ) ),
this, SLOT( toggleManualTab() ) );

L.Marvell
15th August 2006, 13:51
There is a toggled(bool) signal, not toggled().

Try:
connect( ui.rbManualMode, SIGNAL( toggled( bool ) ),
this, SLOT( toggleManualTab() ) );
So isn't it has to be

connect( ui.rbManualMode, SIGNAL( toggled( bool ) ),
this, SLOT( toggleManualTab( bool ) ) );

jacek
15th August 2006, 14:22
So isn't it has to be [...]
Not with current toggleManualTab() implementation, since it doesn't take any arguments.

With:

connect( ui.rbManualMode, SIGNAL( toggled( bool ) ),
this, SLOT( toggleManualTab( bool ) ) );
that slot should look like this:

void ConfigurationForm::toggleManualTab( bool bEnableTab )
{
ui.twConfig->setTabEnabled( 1, bEnableTab );
}

@bpetty:
If you have similar slots for other tabs, consider using QSignalMapper.