我简单写下我的代码吧
#ifndef MAIN_H
#define MAIN_H
#include
#include
#include
class mywidget:public QWidget
{
Q_OBJECT
public:
mywidget(QWidget *parent = 0);
QRadioButton *a;
QRadioButton *b;
private slots:
void mycheck();
};
mywidget::mywidget(QWidget *parent):QWidget(parent)
{
QRadioButton *a = new QradioButton(tr("1111"), this);
a->setGeometry(40, 40, 40, 40);
QRadioButton *b = new QRadioButton(tr("22222"), this);
b->setGeometry(100, 100, 100, 100);
connect(a, SIGNAL(clicked()), b, SLOT(mycheck()));
}
void mywidget::mycheck()
{
b->setCheckabel(1);
b->setChecked(1) ;
b->setAutoRepeatl(1);
b->setAutoExclusive(1);
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
mywidget w;
w.show();
retrun a.exec();
}
}
;
}
}
}