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. Cutom events use case

Cutom events use case

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 568 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.
  • E Offline
    E Offline
    Eligijus
    wrote on last edited by
    #1

    Hello,
    I've been reading about Qt event system and found out that one can create their own custom events.
    It appears that custom events work very similarly to signal-slot mechanism. So what would be the use case for custom events? Why not just use signals and slots? Is there any advantage in using custom events instead of signals and slots?

    Thanks for your answers.

    raven-worxR 1 Reply Last reply
    0
    • E Eligijus

      Hello,
      I've been reading about Qt event system and found out that one can create their own custom events.
      It appears that custom events work very similarly to signal-slot mechanism. So what would be the use case for custom events? Why not just use signals and slots? Is there any advantage in using custom events instead of signals and slots?

      Thanks for your answers.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @Eligijus said in Cutom events use case:

      It appears that custom events work very similarly to signal-slot mechanism.

      They have some mechanics in common, but still their field of usage is different.
      Signals have a 1:n relationship, where events have a 1:1 relationship. Events also have the advantage that you can use an even-filter, which isn't possible with signals-slots.
      You can install an event filter on the QApplication instance and filter an event before it is sent to any object.

      Some events support event-compression, means multiple events in the same event-loop iteration get compressed to a single event (like the paint event for example). Unfortunately this isn't possible for custom events yet though. (Without a dependency to private Qt classes)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2

      • Login

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