{
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();
}
};
class X : public QObject
{
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();
}
};
To copy to clipboard, switch view to plain text mode
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.
Bookmarks