void uVision::createThumbnail(const QString& filename) { //qDebug() << filename; QThread* thread = new thumbnailthread(filename, 10 - waitseconds); waitseconds ++; connect(thread,SIGNAL(thumbnailFinishedInstitch(QImage)),this,SLOT(addInstitchImages(QImage))); connect(thread, SIGNAL(thumbnailFinished(QImage)), this, SLOT(addThumbnail(QImage))); connect(thread, SIGNAL(thumbnailFailed(const QString)), this, SLOT(showError(const QString))); connect(thread, SIGNAL(finished()), this, SLOT(deleteThread())); thread->start(); }
void ThumbnailThread::run() { if( bigpm.isNull()) { emit thumbnailFailed(pmfilename); } else { //qWarning() << "thread start..." << number; sleep(number); smallpm = bigpm.scaled(TN_WIDTH, TN_HEIGHT, Qt::KeepAspectRatio); emit thumbnailFinished(smallpm); } }