Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. slot not being called by QFutureWatcher

slot not being called by QFutureWatcher

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 272 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SRaD
    wrote on last edited by
    #1

    I have a function that runs the following ioStart() task with QtConcurrent::run() and when it is finished, the slot MainWindow::ioFinished() doesn't get called.

    {   
        QFutureWatcher<int> watcher;
    
        connect(&watcher, &QFutureWatcher<int>::finished, this,
            &MainWindow::ioFinished);
    
        QFuture<int> future = QtConcurrent::run(this, &MainWindow::ioStart, name);
    
        watcher.setFuture(future);    
    }
    

    I have it defined in the cpp and in the MainWindow.h ...

    public slots:
        void ioFinished();
    

    Anyone have ideas?

    jeremy_kJ 1 Reply Last reply
    0
    • S Offline
      S Offline
      SRaD
      wrote on last edited by
      #3

      Ugh, thanks, that was it.

      1 Reply Last reply
      0
      • S SRaD

        I have a function that runs the following ioStart() task with QtConcurrent::run() and when it is finished, the slot MainWindow::ioFinished() doesn't get called.

        {   
            QFutureWatcher<int> watcher;
        
            connect(&watcher, &QFutureWatcher<int>::finished, this,
                &MainWindow::ioFinished);
        
            QFuture<int> future = QtConcurrent::run(this, &MainWindow::ioStart, name);
        
            watcher.setFuture(future);    
        }
        

        I have it defined in the cpp and in the MainWindow.h ...

        public slots:
            void ioFinished();
        

        Anyone have ideas?

        jeremy_kJ Offline
        jeremy_kJ Offline
        jeremy_k
        wrote on last edited by
        #2

        Is that allocation of the watcher accurate? If so, it goes out of scope immediately after the call to setFuture().

        Asking a question about code? http://eel.is/iso-c++/testcase/

        1 Reply Last reply
        2
        • S Offline
          S Offline
          SRaD
          wrote on last edited by
          #3

          Ugh, thanks, that was it.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved