[Solved]why several rationbutton cannot be connect to same slot?
-
I used QtDesigner created a interface which includes FD, TD50, TD33 , TD25 four radio buttons in a group. the code generated by UI is
@
layoutWidget_3 = new QWidget(WaveFormGroupBox);
layoutWidget_3->setObjectName(QString::fromUtf8("layoutWidget_3"));
layoutWidget_3->setGeometry(QRect(10, 31, 181, 62));
WaveFormLayout = new QGridLayout(layoutWidget_3);
WaveFormLayout->setSpacing(6);
WaveFormLayout->setContentsMargins(11, 11, 11, 11);
WaveFormLayout->setObjectName(QString::fromUtf8("WaveFormLayout"));
WaveFormLayout->setContentsMargins(0, 0, 0, 0);
FDradioButton = new QRadioButton(layoutWidget_3);
FDradioButton->setObjectName(QString::fromUtf8("FDradioButton"));
FDradioButton->setChecked(true);WaveFormLayout->addWidget(FDradioButton, 0, 0, 1, 1); TD25radioButton = new QRadioButton(layoutWidget_3); TD25radioButton->setObjectName(QString::fromUtf8("TD25radioButton")); WaveFormLayout->addWidget(TD25radioButton, 1, 0, 1, 1); TD33radioButton = new QRadioButton(layoutWidget_3); TD33radioButton->setObjectName(QString::fromUtf8("TD33radioButton")); WaveFormLayout->addWidget(TD33radioButton, 1, 1, 1, 1); TD50radioButton = new QRadioButton(layoutWidget_3); TD50radioButton->setObjectName(QString::fromUtf8("TD50radioButton")); WaveFormLayout->addWidget(TD50radioButton, 0, 1, 1, 1);
@
then in the constructor of my class, I tried to connect these radio button to the same slot
@
connect(ui->FDradioButton, SIGNAL(toggled()), this, SLOT(waveformToggled()));
connect(ui->TD50radioButton, SIGNAL(clicked())), this, SLOT(waveformToggled());
@
only connection for FDradionButton works, all the others give me compiling error:
no matching function for call to remote::connect(QRadioButtons *&, const char *)'
and the lists four candiates for the matching function.**found the problem, the "()" does not match correctly,
@ connect(ui->TD50radioButton, SIGNAL(clicked())), this, SLOT(waveformToggled());@
should be
@ connect(ui->TD50radioButton, SIGNAL(clicked()), this, SLOT(waveformToggled()));@
Qt editor does not highlight this kind of error. :(