Results 1 to 6 of 6

Thread: QFutureWatcher signals not firing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QFutureWatcher signals not firing

    Has anyone had problems with QFutureWatcher signals not firing? Here's the code:
    Qt Code:
    1. QFutureWatcher<void> watcher;
    2.  
    3. connect(&watcher, SIGNAL(progressRangeChanged(int, int)), this, SLOT(progressRangeChanged(int, int)));
    4. connect(&watcher, SIGNAL(progressValueChanged(int)), this, SLOT(progressValueChanged(int)));
    5. connect(&watcher, SIGNAL(finished()), this, SLOT(finished()));
    6.  
    7. QFuture<dent_vec_t> dent_scan_future = QtConcurrent::mappedReduced(all_joint_scan_params,dent_scan_with_line,&combine_dent_lists);
    8. watcher.setFuture(dent_scan_future);
    9. while (!watcher.isFinished())
    10. {
    11. //Some debug code
    12. int prog1 = watcher.progressMinimum();
    13. int prog2 = watcher.progressMaximum();
    14. int progValue = watcher.progressValue();
    15. }
    16. m_dents = dent_scan_future.result();
    To copy to clipboard, switch view to plain text mode 

    I threw in the debug code to see if there's any progress to report, and there is. Here are my slots:

    Header:
    Qt Code:
    1. public slots:
    2. void finished();
    3. void progressRangeChanged(int, int);
    4. void progressValueChanged(int);
    To copy to clipboard, switch view to plain text mode 

    CPP:
    Qt Code:
    1. void dent_scanner::finished()
    2. {
    3. cout<<"FINISHED"<<endl;
    4. }
    5.  
    6. void dent_scanner::progressRangeChanged(int a, int b)
    7. {
    8. cout<<"PROGRESS RANGE CHANGED: " <<a<<", "<<b<<endl;
    9. }
    10.  
    11. void dent_scanner::progressValueChanged(int a)
    12. {
    13. cout<<"PROGRESS VALUE CHANGED: " <<a<<endl;
    14. }
    To copy to clipboard, switch view to plain text mode 

    This code won't execute no matter what I do. I have the Q_OBJECT macro in the header, and the moc file included at the bottom. The class inherits from QOBject. No errors print out when I connect up the signals and slots (already fixed that problem...)

    I can usually find my way around signals and slots just fine. I probably just made a stupid mistake, but can't seem to figure out what it is. Any thoughts?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QFutureWatcher signals not firing

    Are you sure the following line is correct?
    Qt Code:
    1. QFutureWatcher<void> watcher;
    To copy to clipboard, switch view to plain text mode 

    Shouldn't that be the the following line?
    Qt Code:
    1. QFutureWatcher<dent_vec_t> watcher;
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QFutureWatcher finished() signal not working
    By DiamonDogX in forum Qt Programming
    Replies: 13
    Last Post: 25th October 2011, 18:27
  2. QProcess finished slot not firing
    By doggrant in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2010, 13:09
  3. QT VS C++ 2005, QPushButton NOT FIRING!!!!!
    By harleyskater in forum General Programming
    Replies: 20
    Last Post: 12th June 2010, 02:15
  4. QSocketNotifier activated() not firing
    By jflatt in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2009, 20:10
  5. How to use progressTextChanged() signal in QFutureWatcher
    By DiamonDogX in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2009, 15:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.