Hi Everyone,
I have 2 classes- ClassA and ClassB. ClassA has a signal called MySignal and ClassB has a slot called MySlot. And the connection is-
connect(ObjClassA ,SIGNAL(MySignal()), ObjClassB,SLOT(MySlot()), Qt::BlockingQueuedConnection);
connect(ObjClassA ,SIGNAL(MySignal()), ObjClassB,SLOT(MySlot()), Qt::BlockingQueuedConnection);
To copy to clipboard, switch view to plain text mode
ClassB has a timer called MyTimer which is connected to MyTimeoutSlot in the same class.
And MySlot is as follows-
void ClassB::MySlot()
{
MyTimer.start(2000); //2 secs
}
void ClassB::MyTimeoutSlot()
{
qDebug("MyTimer expired");
}
void ClassB::MySlot()
{
MyTimer.start(2000); //2 secs
}
void ClassB::MyTimeoutSlot()
{
qDebug("MyTimer expired");
}
To copy to clipboard, switch view to plain text mode
The scenario is such that MySignal is emitted continuously (synchronization is taken care of, I mean only after MyTimeoutSlot is finished executing then only next emission of MySignal happens). But what I observed is that sometimes MyTimer doesn't start or worst doesn't expire (I am not sure which among these two is happening).
Since QTimer is being started inside a slot whose connection type is BlockingQueuedConnection, is that causing an issue?
Has someone before encountered such issues wherein QTimer doesn't start or expire?
Bookmarks