Hi,
My program starts new thread for making PDF files having many pictures and other heavy stuff. During creation of those PDFs, I want that the main window to show animation indicating that PDF is on progress and stop the animation once PDF is ready.
Problem is that it seems that my QFutureWatcher never receives the finished signal and go to the pysayta_lataus_animaatio() function. I've used hours and hours trying to resolve what's wrong here but cannot figure it out.
Can someone see what is wrong with this code? Thanks in advance!
mainwindow.h
public slots:
void pysayta_lataus_animaatio();
public slots:
void pysayta_lataus_animaatio();
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
void MainWindow::on_pB_yhtio_laskut_clicked() // slot, called when user selected push button for creating PDF
{
TRACE("-> void MainWindow::on_pB_yhtio_laskut_clicked()");
QFutureWatcher lataus_watcher;
connect(&lataus_watcher, SIGNAL(finished()), this, SLOT(pysayta_lataus_animaatio()));
QFuture future = QtConcurrent::run(this, &MainWindow::PDF_laskut_yhtio);
lataus_watcher.setFuture(future);
TRACE("Watcher set.");
processLabel->setMovie(movie);
processLabel->setFixedSize(50,50);
processLabel->move(430,93);
movie->start();
processLabel->show();
TRACE("animation started");
}
void MainWindow::pysayta_lataus_animaatio()
{
TRACE("-> void MainWindow::pysayta_lataus_animaatio()"); // TRACE writes given QString to a log file.
//TBD: stop the animation
}
void MainWindow::on_pB_yhtio_laskut_clicked() // slot, called when user selected push button for creating PDF
{
TRACE("-> void MainWindow::on_pB_yhtio_laskut_clicked()");
QFutureWatcher lataus_watcher;
connect(&lataus_watcher, SIGNAL(finished()), this, SLOT(pysayta_lataus_animaatio()));
QFuture future = QtConcurrent::run(this, &MainWindow::PDF_laskut_yhtio);
lataus_watcher.setFuture(future);
TRACE("Watcher set.");
QMovie *movie = new QMovie(":kuvat/lataa_pieni.gif");
QLabel *processLabel = new QLabel(this);
processLabel->setMovie(movie);
processLabel->setFixedSize(50,50);
processLabel->move(430,93);
movie->start();
processLabel->show();
TRACE("animation started");
}
void MainWindow::pysayta_lataus_animaatio()
{
TRACE("-> void MainWindow::pysayta_lataus_animaatio()"); // TRACE writes given QString to a log file.
//TBD: stop the animation
}
To copy to clipboard, switch view to plain text mode
Bookmarks