Important: Please read the Qt Code of Conduct -

slot not being called by QFutureWatcher

  • 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,
        QFuture<int> future = QtConcurrent::run(this, &MainWindow::ioStart, name);

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

    public slots:
        void ioFinished();

    Anyone have ideas?

  • Ugh, thanks, that was it.

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

  • Ugh, thanks, that was it.

Log in to reply