Use 'QtConcurrent::run()' with a static member function



  • Greetings.

    I want to use 'QtConcurrent::run()' with a static member function of a class that I developed, but it generates a compiler error.

    I read the documentation of this function and review of <QtConcurrentRun>. This explains how to use 'QtConcurrent::run()' with a class member function (and that is how I trying to use it), but do not know if the fact that it is a static member function can affect.

    Thanks in advance for any answers and/or suggestions



  • A static member function behaves basically like a non-member function (except that you prepend the class scope of course).
    @
    void someNonMemberFunction() {}

    class SomeClass
    {
    public:
    static void someStaticMemberFunction() {}
    };

    QtConcurrent::run(someNonMemberFunction);
    QtConcurrent::run(SomeClass::someStaticMemberFunction);
    @


Log in to reply
 

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