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. Interaction between dialog boxes and main window
Qt 6.11 is out! See what's new in the release blog

Interaction between dialog boxes and main window

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 4.2k 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.
  • Z Offline
    Z Offline
    Zain
    wrote on last edited by
    #1

    Hello All,

    Please help me to get interaction(passing some values) between dialog-dialog and dialog-main window.
    It would be very helpful if you provide some code or links for similar examples.

    Any suggestion appreciated.
    Thanks in Advance

    Zain

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      It is not really clear what you mean, some code will be helpful. In any way the answer will be: use signal/slot connection to communicate between objects... Here is video tutorial: "C++ Qt 04 - Signals and Slots":http://www.youtube.com/watch?v=JtyCM4BTbYo

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zain
        wrote on last edited by
        #3

        Thanks for the reply,

        I am trying to make it more clear:

        • I am trying to create some dialogs, which will return some value to the another dialog (which exec() or show the first dialog )when we close these.

        I have tried to write the close event , but don't know how a dialog returns a value to its parent.

        I want to have a three level dialog calling system .(mainWindow -> dialog -> subDialog).
        And the values will be returned in a manner like.(subDialog -> dialog -> mainWindow).

        Please help me for this.

        Any suggestion appreciated.

        Thanks and Regards

        Zain

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tilsitt
          wrote on last edited by
          #4

          Like AcerExtensa told you: use signals and slots.

          In your case, you could emit a signal from subDialog in closeEvent, which will be connected to dialog and then from dialog to mainWindow.

          Another way could be to use a defined value with QDialog::done().

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vittalonline
            wrote on last edited by
            #5

            if you want passing arguments.. this example illustrates pass a int value as an argument in
            signal/slot mechanism.

            in header file

            Q_PROPERTY(int curState READ curState NOTIFY changeState)

            public:
            int curState();

            signals:
            void changeState(int);


            in CPP

            int ClassName::curState() // write a get method in cpp
            {
            return crstate;
            }

            Now you can use signal/slot mechanism whatever you want either
            interaction(passing some values) between dialog-dialog and dialog-main window
            or other.

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vittalonline
              wrote on last edited by
              #6

              in the above code
              emit a signal "changeState" from Dialogbox in closeEvent, which will be pass value from dialog to dialog or from dialog to mainWindow.

              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