@Santosh Reddy Thanks for reply. I know, and already implemented, solution with QTimer and timeout() (works like a charm, except it's 6 time slower then signal/slot "solution", probably due all those timer checks), see my first post, but I'm looking, because of educational reason, for more possibilities to solve this problem, preferred without QThread.
@Lykurg
The code is irrelevant and I wanted only show the idea and the problem with signal/slot queue stacking.
Yes "count" is global, I wanted just show type of it, and Line 3 is an error, should be controlSLOT();
corrected Example:
void myProgrma::myProgrma(){
connect( this, SIGNAL( jobDone() ), this, SLOT(controlSLOT()));
controlSLOT();
count = 12000; //int count global
}
void myProgrma::controlSLOT()
{
if(count == 12000)
return;
else
doJobSLOT()
}
void myProgrma::doJobSLOT()
{
//do job here
emit jobDone();
}
void myProgrma::myProgrma(){
connect( this, SIGNAL( jobDone() ), this, SLOT(controlSLOT()));
controlSLOT();
count = 12000; //int count global
}
void myProgrma::controlSLOT()
{
if(count == 12000)
return;
else
doJobSLOT()
}
void myProgrma::doJobSLOT()
{
//do job here
emit jobDone();
}
To copy to clipboard, switch view to plain text mode
I attached an example that shows the error of signal/slot and QTimer solution. QTimer is slower then signal/slot.
Bookmarks