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
Qt Code:
  1. public slots:
  2.  
  3. void pysayta_lataus_animaatio();
To copy to clipboard, switch view to plain text mode 

mainwindow.cpp
Qt Code:
  1. void MainWindow::on_pB_yhtio_laskut_clicked() // slot, called when user selected push button for creating PDF
  2. {
  3. TRACE("-> void MainWindow::on_pB_yhtio_laskut_clicked()");
  4.  
  5. QFutureWatcher lataus_watcher;
  6. connect(&lataus_watcher, SIGNAL(finished()), this, SLOT(pysayta_lataus_animaatio()));
  7. QFuture future = QtConcurrent::run(this, &MainWindow::PDF_laskut_yhtio);
  8. lataus_watcher.setFuture(future);
  9. TRACE("Watcher set.");
  10.  
  11. QMovie *movie = new QMovie(":kuvat/lataa_pieni.gif");
  12. QLabel *processLabel = new QLabel(this);
  13. processLabel->setMovie(movie);
  14. processLabel->setFixedSize(50,50);
  15. processLabel->move(430,93);
  16. movie->start();
  17. processLabel->show();
  18. TRACE("animation started");
  19. }
  20.  
  21. void MainWindow::pysayta_lataus_animaatio()
  22. {
  23. TRACE("-> void MainWindow::pysayta_lataus_animaatio()"); // TRACE writes given QString to a log file.
  24. //TBD: stop the animation
  25. }
To copy to clipboard, switch view to plain text mode