Hi all,
I'm so fustrated because I'm trying to solve a problem with signals ans slot (C++ programming) and at the moment I don´t find the solution.
This thing is the following, I did a SDK (MSVC 2010 C++) for capturing information from one camera. In this SDK there 2 windows threads (runniong through _beginthread), one thread read the information and another one decode this information when available and change the state of 1 shared variable.
The program who use the SDK (QT visualizer), launch a QT thread to see the shared variable and when this variable change emit a signal in order to execute a slot.
The code is :
thread = new QThread();
painter = new Painter();
painter->moveToThread(thread);
connect(painter, SIGNAL(workRequested()), thread, SLOT(start()));
connect(thread, SIGNAL(started()), painter, SLOT(doWork()));
connect(painter, SIGNAL(finished()), thread, SLOT(quit()), Qt:irectConnection);
connect(painter, SIGNAL (MyNewSignal(int)), this, SLOT(On_Called_MyNewSignal(int)));
And the behavior is not the expected, I received consecutives signals and execution of the slot not sincronyzed, for exemple :
I can received something like that :
emitmysignal(MyNewSignal)
emitmysignal(MyNewSignal)
emitmysignal(MyNewSignal)
emitmysignal (MyNewSignal)
On_Called_MyNewSignal
On_Called_MyNewSignal
On_Called_MyNewSignal
On_Called_MyNewSignal
emitmysignal(MyNewSignal)
emitmysignal (MyNewSignal)
On_Called_MyNewSignal
emitmysignal (MyNewSignal)
On_Called_MyNewSignal
On_Called_MyNewSignal
The execution of the slot is not immediately after the emitmysignal.
What I'm doing wrong ?
Anyone can help me ?
Advanced thanks.
Ferdinand
Bookmarks