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. Best way to send global notifications to my application ?
Forum Updated to NodeBB v4.3 + New Features

Best way to send global notifications to my application ?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 938 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.
  • D Offline
    D Offline
    divide
    wrote on last edited by
    #1

    Hi,

    I have some global events in my application (when some state/property change and all classes need to be notified) but I'm not sure what's the best way to notify them with Qt:

    -sendEvent/postEvent does not allow sending an event to all QObject classes, you have to specify which QObject class you want to send the event to

    -signals/slots need to be manually connected to each and every parent/child/child of child/brother/cousin classes that needs to receive notifications, so it looks like a big plate of spaghetti... I'm not quite sure what would be the best architecture in this case

    -Is there any other way I'm not aware of ?

    Thanks !

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xander84
      wrote on last edited by
      #2

      do you really need to send an event to all your objects? seems a little weird to me. I guess we need to know a little bit more about your application, maybe there is another way instead of 500 signal/slot connection :D

      1 Reply Last reply
      0
      • D Offline
        D Offline
        divide
        wrote on last edited by
        #3

        It's a paint application with different image layers (think of Photoshop).
        I have common project properties like project format, list of layers, etc..
        There are event such as "LayerContentChanged" which can be triggered either by the class dedicated to image filtering, image painting, layer list manager... and every class dealing with theses layers (either classes processing thoses layers or just reading its content for display) must be notified of it.

        What would you suggest ?

        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