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. [Solved] Signal slot between two windows
Forum Updated to NodeBB v4.3 + New Features

[Solved] Signal slot between two windows

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.5k 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.
  • M Offline
    M Offline
    MikeWagman
    wrote on last edited by
    #1

    I have two windows - one is the main program, I open a second window to get some data that needs to go back to the first window. When OK button is clicked I want to pass data via signal / slot.

    But I can't figure out how to identify the main window from the primary, or the right way to reference the 2nd window and set it up from the main.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      henryxuv
      wrote on last edited by
      #2

      Maybe , you want something like this?
      @
      MainWindow
      {
      public slots:
      void onChildOk(); //slot to receive signal from child
      protected:
      ChildWindow *pChild;
      }

      ChildWindow
      {
      public slots:
      void on_YourButton_clicked()//the slot to signal which emit when you click ok button
      {
      emit buttonClick; //send buttonClick signal to mainwindow
      }
      signal:
      void buttonClick();
      }
      //Then call connect at the mainwindow . connect(pChild,SIGNAL(buttonClick()),this, SLOT(onChildOk()))
      @

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rahul Das
        wrote on last edited by
        #3

        "Examples":http://doc.qt.nokia.com/4.7-snapshot/dialogs-standarddialogs.html


        Declaration of (Platform) independence.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MikeWagman
          wrote on last edited by
          #4

          Thanks I got it

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rahul Das
            wrote on last edited by
            #5

            Please mark the title as "Solved", if it is solved :)


            Declaration of (Platform) independence.

            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