16,203
社区成员
发帖
与我相关
我的任务
分享
QPushButton *m_button[2];
m_button[0] = new QPushButton(this);
connect(m_button[0], SIGNAL(clicked()), this, SLOT(slot_button0_clicked()));
m_button[1] = NULL;
if(NULL == m_button[1])
{
m_button[1] = new QPushButton(this);
connect(m_button[1], SIGNAL(clicked()), this, SLOT(slot_button1_clicked()));
}
class A:public QObject
{
Q_Object
QPushButton * a;
myClass * b;
A();
}
// 假设b中有slot函数: mySlot();
A::A(){
a = new QPushButton();
b = new myClass();
connect(a,SIGNAL(clicked()),b, mySlot();
}
class A:public QObject
{
Q_Object
QPushButton * a;
myClass * b;
A();
}
// 假设b中有slot函数: mySlot();
A::A(){
a = new QPushButton();
b = new myClass();
connect(a,SIGNAL(clicked()),b, mySlot();
}
class A:pubic QObject
{
Q_Object
QPushButton * a;
signals:
void mySignals();
public slots:
bSlot(){
emit mySignals();
}
aSlot(){
QPushButton b = new QPushButton();
connect(a, SIGNAL(clicked()), b, SLOT(mySlot()));
}
}