Something in the lines of this will work:
class RotationClass
: public QObject{
Q_OBJECT
public:
RotationClass();
void setImage(imagefile);
public slots:
void doRotation();
signals:
void rotationFinished(imagefile);
}
// Implement the RotationClass
// To use it:
RotationClass *rotator = new RotationClass;
rotator->setImage(someImage);
connect(anotherClass, SIGNAL(whatever()), rotator, SLOT(doRotation()));
rotator->moveToThread(workerThread);
workerThread->start();
class RotationClass : public QObject
{
Q_OBJECT
public:
RotationClass();
void setImage(imagefile);
public slots:
void doRotation();
signals:
void rotationFinished(imagefile);
}
// Implement the RotationClass
// To use it:
RotationClass *rotator = new RotationClass;
rotator->setImage(someImage);
connect(anotherClass, SIGNAL(whatever()), rotator, SLOT(doRotation()));
QThread *workerThread = new QThread;
rotator->moveToThread(workerThread);
workerThread->start();
To copy to clipboard, switch view to plain text mode
Make sure that your version of Qt starts an eventloop when doing workerThread->start().
Bookmarks