Results 1 to 4 of 4

Thread: QtConcurrent::run() with function member?

  1. #1
    Join Date
    Jun 2010
    Posts
    38
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question QtConcurrent::run() with function member?

    I can't seem to be able to associate QtConcurrent::run() with a method (function member of a class) only with a simple function. How can I do this.

    Qt Code:
    1. ... ...
    2. QVector<double> MyClass::execute(QModelIndex index,QVector<double> args)
    3. {
    4. ..........
    5. }
    6.  
    7. QVector<double> MyClas::caculator(QModelIndex index,QVector<double> args)
    8. {
    9. QFuture<QVector<double> > future = QtConcurrent::run(&MyClas::execute,index,args);
    10. ...........
    To copy to clipboard, switch view to plain text mode 

    error: no matching function for call to 'run(<unresolved overloaded function type>, QModelIndex&, QVector<double>&)'

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtConcurrent::run() with function member?

    And how with :
    Qt Code:
    1. QFuture<QVector<double> > future = QtConcurrent::run(this->execute,index,args);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jun 2010
    Posts
    38
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QtConcurrent::run() with function member?

    Quote Originally Posted by Lesiok View Post
    And how with :
    Qt Code:
    1. QFuture<QVector<double> > future = QtConcurrent::run(this->execute,index,args);
    To copy to clipboard, switch view to plain text mode 
    I have try this way, and it show the same error.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtConcurrent::run() with function member?

    Just read carefully this docs. Here are examples how to run static and non static member functions.

  5. The following user says thank you to Lesiok for this useful post:

    y.shan (15th September 2010)

Similar Threads

  1. Replies: 10
    Last Post: 4th June 2010, 09:43
  2. static member function
    By freekill in forum Newbie
    Replies: 4
    Last Post: 29th July 2009, 15:23
  3. How to call the C++ member function from the JScript
    By parusri in forum Qt Programming
    Replies: 1
    Last Post: 18th October 2008, 10:13
  4. Replies: 22
    Last Post: 8th October 2008, 13:54
  5. Y is className a member function rather than a static one ?
    By sunil.thaha in forum Qt Programming
    Replies: 7
    Last Post: 12th January 2007, 00:43

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.