StarShaper
7th February 2012, 02:29
I have some strange problems with one SIGNAL/SLOT.
There is one class A::B::Class1 that emits two signals, first without argument, second with one argument.
A::B::J param;
emit orange(param); // Not executed
emit blue();
In A::C::Class2 the signals and slots are connected. Both connections returns true, but only 1 Slot gets executed, that one without any parameter.
void V::run()
{
object = new Object();
connect(object, SIGNAL(blue()), this, SLOT(blue_exec()));
connect(object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)));
//...
exec();
}
It is definately a problem with the SIGNAL.
I just did a test with Qt::ConnectionType and a test allocating object on stack with Object object and
void V::run()
{
Object object;
connect(&object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)));
//...
exec();
}
It works. Same thing, if I use Qt::DirectConnection.
void V::run()
{
object = new Object();
connect(object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)), Qt::DirectConnection);
//...
exec();
}
That doesn't make sense to me. Why the first connection gets executed, while the second does not. Both are using the same "object"?
:confused:
There is one class A::B::Class1 that emits two signals, first without argument, second with one argument.
A::B::J param;
emit orange(param); // Not executed
emit blue();
In A::C::Class2 the signals and slots are connected. Both connections returns true, but only 1 Slot gets executed, that one without any parameter.
void V::run()
{
object = new Object();
connect(object, SIGNAL(blue()), this, SLOT(blue_exec()));
connect(object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)));
//...
exec();
}
It is definately a problem with the SIGNAL.
I just did a test with Qt::ConnectionType and a test allocating object on stack with Object object and
void V::run()
{
Object object;
connect(&object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)));
//...
exec();
}
It works. Same thing, if I use Qt::DirectConnection.
void V::run()
{
object = new Object();
connect(object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)), Qt::DirectConnection);
//...
exec();
}
That doesn't make sense to me. Why the first connection gets executed, while the second does not. Both are using the same "object"?
:confused: