locke
30th July 2010, 15:53
Hi guys, Im sorry if I cannot explain properly the situation
lets get some
the header could be header.h
class A:
{
signals:
MySignal();
};
class MainWindow
{
A * a:
// More things
//........
};
class B
{
public:
B(A* a);
private slots:
myDummySlotInB()
private:
A* my_a;
}
lets see supose that the cpp file contains
MainWindow::MainWindow()
{
connect(a, SIGNAL(MySignal()), this, SLOT(dummySlot()));
//......
}
B::B(A* a)
{
my_a = a;
connect(my_a, SIGNAL(MySignal()), this, SLOT(dummySlotInB()));
}
Why the connection in the constructor of MainWindow is working properly, and no the connection in the constructor of B?. I just copied the pointer, so my_a is poiting to (*a) as well. Then, if the pointer a emits the signal, Why I cannot catch it in B?
Thanks
lets get some
the header could be header.h
class A:
{
signals:
MySignal();
};
class MainWindow
{
A * a:
// More things
//........
};
class B
{
public:
B(A* a);
private slots:
myDummySlotInB()
private:
A* my_a;
}
lets see supose that the cpp file contains
MainWindow::MainWindow()
{
connect(a, SIGNAL(MySignal()), this, SLOT(dummySlot()));
//......
}
B::B(A* a)
{
my_a = a;
connect(my_a, SIGNAL(MySignal()), this, SLOT(dummySlotInB()));
}
Why the connection in the constructor of MainWindow is working properly, and no the connection in the constructor of B?. I just copied the pointer, so my_a is poiting to (*a) as well. Then, if the pointer a emits the signal, Why I cannot catch it in B?
Thanks