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. [SOLVED]QtConcurrent not working
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QtConcurrent not working

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k 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.
  • saeedhardanS Offline
    saeedhardanS Offline
    saeedhardan
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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();
      @

      (Z(:^

      1 Reply Last reply
      0
      • saeedhardanS Offline
        saeedhardanS Offline
        saeedhardan
        wrote on last edited by
        #3

        yep, with that it worked, thanks.

        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