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();
A::B::J param;
emit orange(param); // Not executed
emit blue();
To copy to clipboard, switch view to plain text mode
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();
}
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();
}
To copy to clipboard, switch view to plain text mode
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();
}
void V::run()
{
Object object;
connect(&object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)));
//...
exec();
}
To copy to clipboard, switch view to plain text mode
It works. Same thing, if I use Qt:
irectConnection.
void V::run()
{
object = new Object();
connect(object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)), Qt::DirectConnection);
//...
exec();
}
void V::run()
{
object = new Object();
connect(object, SIGNAL(orange(A::B::J&)), this, SLOT(orange_exec(A::B::J&)), Qt::DirectConnection);
//...
exec();
}
To copy to clipboard, switch view to plain text mode
That doesn't make sense to me. Why the first connection gets executed, while the second does not. Both are using the same "object"?
Bookmarks