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. Communication between objects (parent and child)

Communication between objects (parent and child)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.8k 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.
  • S Offline
    S Offline
    shimano
    wrote on last edited by
    #1

    Hello everyone,

    I wonder how to implement communication between classes and objects hierarchy like parent and child?

    For example, I'd like to make authentication system for multiwindow application, so I guess I need an object to store information that user is logged in and which user it is. But if I make it in one class (for example AuthUser) and I'll make few more objects (maybe QDialogs) from different class (fo example AppEngine) then how to implement communication between all these objects?

    And what if some objects create other child-objects? How to make all these objects communicative to each other, for example to verify authorization and allow or disallow execute their methods?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      Hi!
      For this case you can use "signal&slot":http://qt-project.org/doc/qt-4.8/signalsandslots.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shimano
        wrote on last edited by
        #3

        I know that, but I don't know how.

        How to receive signal from parent object?
        Send to child is easy, but I don't know how to receive that signal.

        MyWindow newWindow;
        connect(this, SIGNAL(someSignal()), newWindow, SLOT(someSlot());

        But what in child?
        connect(parent??, SIGNAL(someSignal()), this, SLOT(someSlot());

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          I do not see how AuthUser fits in into a parent/child relation with dialogs.

          If you only ever have one user authenticated you could make AuthUser a singleton and access it like any singleton object.

          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