Re: Question about QTimer
If I am not clear, please, reply me about that.
Re: Question about QTimer
i) to just once call that singleshot timer, why not just place that call before the loop?
ii) QTimer events are process only by a running event loop; your code is busy running your while loop, thus no event loop is run, thus no timer events are process and your slot is never called
iii) if you want, you can place the "crossCapture" stuff into a separate thread (if it is a long running operation)
iv) either way:
use a signal to trigger crossCapture(); the exit the calling function (**)
use another signal, to "continue" where (**) left off
HTH
Re: Question about QTimer
use a signal to trigger crossCapture(); the exit the calling function (**)
use another signal, to "continue" where (**) left off
Will you please give some detail, may be with some code.
Re: Question about QTimer
Code:
{
Q_OBJECT
X()
{
connect(this, SIGNAL(crossCaptureComplete()), SLOT(continue_it()));
}
Q_SIGNALS:
void crossCaptureComplete();
QTimer::singleShot(1500,
this,
SLOT(crossCapture
()));
public Q_SLOTS:
// split the method that is interrupted by crossCapture in 2 parts:
void start_it()
{
// do something
// trigger cross
QTimer::singleShot(1500,
this,
SLOT(crossCapture
()));
}
void continue_it()
{
// ...
}
// might run in a different object or thread...
void crossCapture()
{
// do something
emit crossCaptureComplete();
}
};
I hope you get the idea. Of course, this is just a sketch and you need to adapt that to whatever you are trying to do.
Re: Question about QTimer
I got the idea and it works.
Thank You very much.