A.H.M. Mahfuzur Rahman
7th August 2009, 14:01
Is it possible to block code before the timeout() signal is emitted?
I tried like this:
void capture(){
int i = 0;
bool allowed = false; // global
while(!allowed){
if(i == 0){
QTimer::singleShot(1500, this, SLOT(crossCapture()));
i = 1;
}
}
QDebug() << "I have finished working with crossCapture()";
}
void crossCapture(){
allowed = true;
}
In this way, I thought QTimer will be called only once, so for crossCapture() and the while loop will continue until allowed is set true in crossCapture().
But, It didn't worked. The while loop goes inifinte,crossCapture() is not even called and QDebug() is not reached.
Please Help.
Thanks
I tried like this:
void capture(){
int i = 0;
bool allowed = false; // global
while(!allowed){
if(i == 0){
QTimer::singleShot(1500, this, SLOT(crossCapture()));
i = 1;
}
}
QDebug() << "I have finished working with crossCapture()";
}
void crossCapture(){
allowed = true;
}
In this way, I thought QTimer will be called only once, so for crossCapture() and the while loop will continue until allowed is set true in crossCapture().
But, It didn't worked. The while loop goes inifinte,crossCapture() is not even called and QDebug() is not reached.
Please Help.
Thanks