我想连接 with以便他们执行相同QToolButtons
的操作。QButtonGroup
QRadioButtons
这是代码:
QToolButton *A=new QToolButton();
A->setCheckable(true);
QButtonGroup *group = new QButtonGroup();
group->addButton(A);
group->addButton(B);
CLASSB *classB=new CLASSB();
connect(A, SIGNAL(clicked(bool)),classB->radioA , SLOT(toggle()));
connect(B, SIGNAL(clicked(bool)), classB->radioB, SLOT(toggle()));
A <->A1 // clicking on tool button should automatically enable radiobutton and should perform the action in radio button
B<->B1
我试过connect(A,SIGNAL(clicked(bool)),A1,SLOT(setChecked(bool)));
了,但没有用。