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. Call method in "parent" window from child window.
Forum Updated to NodeBB v4.3 + New Features

Call method in "parent" window from child window.

Scheduled Pinned Locked Moved General and Desktop
17 Posts 5 Posters 18.6k 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.
  • R Offline
    R Offline
    Rahul Das
    wrote on last edited by
    #8

    Well, looks like it is :).. Why dont you give it a try ?


    Declaration of (Platform) independence.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #9

      Looks like a good start, if you actually created that signal and that slot.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maxmotor
        wrote on last edited by
        #10

        Hm - Nothing seems to happen I'm afraid.

        I should mention that my slot method is completely empty. I just use it as a trigger.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #11

          A slot is not a trigger. A signal is (sort of). The slot should actually do something.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            maxmotor
            wrote on last edited by
            #12

            Oh my mistake. I meant signal. My signal is only a trigger :) Sorry

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #13

              You do know that you are only supposed to give a declaration of a signal, right? No implementation allowed!

              So, only do:
              @
              //MyChildWindow.h
              class MyChildWindow: public QDialog
              {
              Q_OBJECT
              /...
              signals:
              void valueChanged(int);
              @

              Moc will provide an implementation for you.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                maxmotor
                wrote on last edited by
                #14

                Thank you!

                2 things:

                1. I did make an empty implementation. Deleted it.
                2. I forgot to declare it a signal in my header file. ("signals:")

                I now seems to be working. The variable is not updated properly, but I guess that's due to an error somewhere else.

                Thank you so much for your time!

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  KA51O
                  wrote on last edited by
                  #15

                  [quote author="maxmotor" date="1316523853"]I'm not sure if I'm doing this correct?

                  @Setup_selectMachine *selectMachine = new Setup_selectMachine();
                  QObject::connect(selectMachine, SIGNAL(valueChanged()), this, SLOT(updateValue()));
                  selectMachine->show();@[/quote]

                  You forgot to specify the signal and slot parameters types (int).
                  @ @Setup_selectMachine *selectMachine = new Setup_selectMachine();
                  QObject::connect(selectMachine, SIGNAL(valueChanged(int)), this, SLOT(updateValue(int)));
                  selectMachine->show(); @

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    maxmotor
                    wrote on last edited by
                    #16

                    No I did not - to quote myself:

                    [quote author="maxmotor" date="1316523853"]I am not sending any values directly via the connection, but instead I'm using a resource class which holds all values.![/quote]

                    So I don't have to send any parameters with the signal.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      KA51O
                      wrote on last edited by
                      #17

                      Sry must have missed that part.

                      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