Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Proper usage of QMetaObject::invokeMethod
Forum Update on Monday, May 27th 2025

Proper usage of QMetaObject::invokeMethod

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qthreadqmetaobject
2 Posts 2 Posters 2.5k Views
  • 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 Offline
    U Offline
    Usman93
    wrote on 21 Oct 2015, 04:26 last edited by
    #1

    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.

    J 1 Reply Last reply 21 Oct 2015, 04:52
    0
    • U Usman93
      21 Oct 2015, 04:26

      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.

      J Offline
      J Offline
      JKSH
      Moderators
      wrote on 21 Oct 2015, 04:52 last edited by
      #2

      @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
      0

      1/2

      21 Oct 2015, 04:26

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved