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. Favour invokeMethod or posting a custom event?
Forum Updated to NodeBB v4.3 + New Features

Favour invokeMethod or posting a custom event?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qeventthreadingsignal & slot
1 Posts 1 Posters 890 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.
  • J Offline
    J Offline
    Jakob
    wrote on last edited by Jakob
    #1

    I'm building a generic way to post a callback on the gui-thread from some background thread (i.e.: any non-gui thread). We have the wanted client-interface in place and a 'UiWorker', which is the QObject that will execute our callback, but there is one detail I can't quite decide upon.

    I can translate the different overloads into a generic function call (std::function), wrap that function object in a custom QEvent class and post the event object on the gui thread by posting it to the UiWorker. Or I do the same translation into a generic function call, but then pass this call to some fixed slot on the UiWorker, which I call using invokeMethod().

    Are there reasons to pick one or the other?

    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