Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Proper usage of QMetaObject::invokeMethod

    Mobile and Embedded
    qthread qmetaobject
    2
    2
    1680
    Loading More Posts
    • 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.
    • U
      Usman93 last edited by

      Hello,

      I read that QMetaObject::invokeMethod shall be used to invoke methods of an object which is affined to a different thread from the calling thread. Lets suppose we have two threads a pthread and a qthread. Is it allowed to call QMetaObject::invokeMethod from pthread to invoke a method of a worker object in Qthread. Could you please help me understand this.

      JKSH 1 Reply Last reply Reply Quote 0
      • JKSH
        JKSH Moderators @Usman93 last edited by

        @Usman93 said:

        I read that QMetaObject::invokeMethod shall be used to invoke methods of an object which is affined to a different thread from the calling thread.

        Correct.

        Lets suppose we have two threads a pthread and a qthread. Is it allowed to call QMetaObject::invokeMethod from pthread to invoke a method of a worker object in Qthread.

        Yes, it's allowed.

        Could you please help me understand this.

        See http://doc.qt.io/qt-5/qmetaobject.html#invokeMethod for some example code.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply Reply Quote 0
        • First post
          Last post