[SOLVED]QtConcurrent not working



  • Hi ,
    im using qt 5.3.1 , my QtConcurrent isnt working .
    This is my code :
    @
    QFuture<bool> future = QtConcurrent::run(sendToFTPServer, &acs_session, remote_dir.c_str(), QDir::cleanPath(path).toLocal8Bit().data());
    bool sent = future.result();
    //bool sent = sendToFTPServer(&acs_session,remote_dir.c_str(),QDir::cleanPath(path).toLocal8Bit().data());
    @
    in include part i tried :
    @
    <QtConcurrent>
    <qtconcurrentrun.h>
    <QtConcurrent/QtConcurrentRun>
    @

    in the .pro file :
    @
    QT += core gui concurrent
    @

    and i ran qmake .
    the weird thing is that i dont get anything in the console nor crashes .
    i know my code is working because if i use the commented line above the files gets transferred , with the QtConcurrent they don't.


  • Moderators

    What about this:
    @
    QFuture<bool> future = QtConcurrent::run(sendToFTPServer, &acs_session, remote_dir.c_str(), QDir::cleanPath(path).toLocal8Bit().data());
    future.waitForFinished();
    bool sent = future.result();
    @



  • yep, with that it worked, thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.