thanks for replying guys.
I went through your link, wagmare.
I think that Waiting in a Local Event Loop or Parallel Programming method will work fine for me.
but i am not sure as to how to use it.
My programs flow is something like this
I press a button, this in turn calls the function that reads the data from the device.
the data is read from the device from 2 separate locations. 1st time its very quick.
the 2nd once takes 25 seconds.
after the reading is over, it performs some calculations and displays the result within 2 seconds.
i dont know where to and how to modify this code
QNetworkAccessManager manager;
tT.setSingleShot(true);
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
connect(&manager, SIGNAL(finished(QNetworkReply*)),
&q, SLOT(quit()));
QNetworkReply *reply = manager.get(QNetworkRequest(
QUrl("http://www.qtcentre.org")));
tT.start(5000); // 5s timeout
q.exec();
if(tT.isActive()){
// download complete
tT.stop();
} else {
// timeout
}
QNetworkAccessManager manager;
QEventLoop q;
QTimer tT;
tT.setSingleShot(true);
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
connect(&manager, SIGNAL(finished(QNetworkReply*)),
&q, SLOT(quit()));
QNetworkReply *reply = manager.get(QNetworkRequest(
QUrl("http://www.qtcentre.org")));
tT.start(5000); // 5s timeout
q.exec();
if(tT.isActive()){
// download complete
tT.stop();
} else {
// timeout
}
To copy to clipboard, switch view to plain text mode
or
QList<QImage> images = loadImages(directory);
ThumbThread *thread = new ThumbThread;
connect(thread, SIGNAL(finished(QList<QImage>)),
this, SLOT(showThumbnails(QList<QImage>)));
thread->start(images);
QList<QImage> images = loadImages(directory);
ThumbThread *thread = new ThumbThread;
connect(thread, SIGNAL(finished(QList<QImage>)),
this, SLOT(showThumbnails(QList<QImage>)));
thread->start(images);
To copy to clipboard, switch view to plain text mode
it would be great if you can help.
Bookmarks