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. signal and slots between two classes
Forum Updated to NodeBB v4.3 + New Features

signal and slots between two classes

Scheduled Pinned Locked Moved General and Desktop
31 Posts 5 Posters 9.8k Views 5 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 mrjj
    12 Oct 2015, 15:43

    @marlenet15 said:
    Hi I think the dialog in dialog mess up something.
    Didnt work for me if I new the sign dialog in Start dialog constructor.
    But it does work if I hooked it up outside.
    Have a look at this example
    https://www.dropbox.com/s/bvpps7qd8oovtjf/gonext.zip?dl=0
    Its the same idea but created slightly different.

    M Offline
    M Offline
    marlenet15
    wrote on 12 Oct 2015, 16:09 last edited by
    #9

    @mrjj I followed your example but it is still not working.

    M 1 Reply Last reply 12 Oct 2015, 16:16
    0
    • M marlenet15
      12 Oct 2015, 16:09

      @mrjj I followed your example but it is still not working.

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 12 Oct 2015, 16:16 last edited by
      #10

      @marlenet15
      ??
      so the getnext example which runs here do no work when you compile it?

      M 1 Reply Last reply 12 Oct 2015, 16:36
      0
      • M mrjj
        12 Oct 2015, 16:16

        @marlenet15
        ??
        so the getnext example which runs here do no work when you compile it?

        M Offline
        M Offline
        marlenet15
        wrote on 12 Oct 2015, 16:36 last edited by
        #11

        @mrjj ok it works. I redid my code using only QWidgets and it works. I think I know the problem and I forgot to mention it. I made QDialog a stacked widget and promoted the file signin.

        1 Reply Last reply
        0
        • M mrjj
          12 Oct 2015, 15:13

          @marlenet15
          Ok, as far as I know you cannot connect signal to signal but you can
          connect multiple signals to one slot.

          Did you place break point to see if the DoNext is called and
          also check in application output that none of the connets return fail.
          maybe even
          qDebug() << " result:" << connect(ui->nextButtonSignin, SIGNAL(clicked()),this,SLOT(DoNext())); for both connect to see
          if they are successful.

          J Offline
          J Offline
          JKSH
          Moderators
          wrote on 12 Oct 2015, 16:39 last edited by JKSH 10 Dec 2015, 16:41
          #12

          @mrjj said:

          Ok, as far as I know you cannot connect signal to signal

          You can. See the documentation:

          You can connect as many signals as you want to a single slot, and a signal can be connected to as many slots as you need. It is even possible to connect a signal directly to another signal. (This will emit the second signal immediately whenever the first is emitted.)

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          M 1 Reply Last reply 12 Oct 2015, 16:44
          1
          • J JKSH
            12 Oct 2015, 16:39

            @mrjj said:

            Ok, as far as I know you cannot connect signal to signal

            You can. See the documentation:

            You can connect as many signals as you want to a single slot, and a signal can be connected to as many slots as you need. It is even possible to connect a signal directly to another signal. (This will emit the second signal immediately whenever the first is emitted.)

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 12 Oct 2015, 16:44 last edited by
            #13

            @JKSH
            Aha, that is news for me. so that is like a chain signal or almost like an alias.

            @marlenet15
            Super. not sure what the real reason was but as long as it works :)

            M 1 Reply Last reply 12 Oct 2015, 16:45
            0
            • M mrjj
              12 Oct 2015, 16:44

              @JKSH
              Aha, that is news for me. so that is like a chain signal or almost like an alias.

              @marlenet15
              Super. not sure what the real reason was but as long as it works :)

              M Offline
              M Offline
              marlenet15
              wrote on 12 Oct 2015, 16:45 last edited by
              #14

              @mrjj Before creating the stackedwidget it worked. After adding it, it doesn't work anymore.

              M 1 Reply Last reply 12 Oct 2015, 16:52
              0
              • M marlenet15
                12 Oct 2015, 16:45

                @mrjj Before creating the stackedwidget it worked. After adding it, it doesn't work anymore.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 12 Oct 2015, 16:52 last edited by
                #15

                @marlenet15
                Ok. do you promote a qDialog to a stackwidget ?
                Not sure I fully understand.
                At least I have never tried that.

                M 1 Reply Last reply 12 Oct 2015, 16:55
                0
                • M mrjj
                  12 Oct 2015, 16:52

                  @marlenet15
                  Ok. do you promote a qDialog to a stackwidget ?
                  Not sure I fully understand.
                  At least I have never tried that.

                  M Offline
                  M Offline
                  marlenet15
                  wrote on 12 Oct 2015, 16:55 last edited by
                  #16

                  @mrjj on the .ui file of the class dialog, I created a stackedwidget and promoted the file signin.h

                  M 1 Reply Last reply 12 Oct 2015, 16:57
                  0
                  • M marlenet15
                    12 Oct 2015, 16:55

                    @mrjj on the .ui file of the class dialog, I created a stackedwidget and promoted the file signin.h

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 12 Oct 2015, 16:57 last edited by
                    #17

                    @marlenet15
                    so the signin dialog was sort of inline to Dialog ?

                    M 1 Reply Last reply 12 Oct 2015, 17:02
                    0
                    • M mrjj
                      12 Oct 2015, 16:57

                      @marlenet15
                      so the signin dialog was sort of inline to Dialog ?

                      M Offline
                      M Offline
                      marlenet15
                      wrote on 12 Oct 2015, 17:02 last edited by
                      #18

                      @mrjj can you exaplain what you mean by that? Sorry

                      M 1 Reply Last reply 12 Oct 2015, 17:12
                      0
                      • M marlenet15
                        12 Oct 2015, 17:02

                        @mrjj can you exaplain what you mean by that? Sorry

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 12 Oct 2015, 17:12 last edited by
                        #19

                        @marlenet15
                        Hi np.
                        Im not 100% sure what you did.
                        If you promote a widget to a dialog.
                        the dialog will be sort of inside the parent/widget that contains the
                        promoted widget.
                        So I wondered if you promoted a stacked widget to the signin dialog ?

                        M 1 Reply Last reply 12 Oct 2015, 17:17
                        0
                        • M mrjj
                          12 Oct 2015, 17:12

                          @marlenet15
                          Hi np.
                          Im not 100% sure what you did.
                          If you promote a widget to a dialog.
                          the dialog will be sort of inside the parent/widget that contains the
                          promoted widget.
                          So I wondered if you promoted a stacked widget to the signin dialog ?

                          M Offline
                          M Offline
                          marlenet15
                          wrote on 12 Oct 2015, 17:17 last edited by
                          #20

                          @mrjj I created a stackedwidget in dialog.ui, in there I promoted signin.h into the stackedwidget.

                          J 1 Reply Last reply 12 Oct 2015, 23:08
                          0
                          • M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 12 Oct 2015, 17:19 last edited by mrjj 10 Dec 2015, 17:19
                            #21

                            ahh that way. Hmm should be the same as using a plain qwidget but seems it was not.

                            Can I ask what kind of design u are after ?
                            like sort of custom wizard style thing ?

                            M 1 Reply Last reply 12 Oct 2015, 17:35
                            0
                            • M mrjj
                              12 Oct 2015, 17:19

                              ahh that way. Hmm should be the same as using a plain qwidget but seems it was not.

                              Can I ask what kind of design u are after ?
                              like sort of custom wizard style thing ?

                              M Offline
                              M Offline
                              marlenet15
                              wrote on 12 Oct 2015, 17:35 last edited by
                              #22

                              @mrjj yes I am. I am doing something simple now in order to understand how it works so that later I can use it so that when i click the button, it goes to the next page.

                              M 1 Reply Last reply 12 Oct 2015, 17:43
                              0
                              • M marlenet15
                                12 Oct 2015, 17:35

                                @mrjj yes I am. I am doing something simple now in order to understand how it works so that later I can use it so that when i click the button, it goes to the next page.

                                M Offline
                                M Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on 12 Oct 2015, 17:43 last edited by
                                #23

                                @marlenet15
                                Ok. but you want it to be standalone Dialogs or pages in a stacked widget ?
                                or you want to use UI files that you promote into the stacked widget?

                                M 1 Reply Last reply 12 Oct 2015, 18:03
                                0
                                • M mrjj
                                  12 Oct 2015, 17:43

                                  @marlenet15
                                  Ok. but you want it to be standalone Dialogs or pages in a stacked widget ?
                                  or you want to use UI files that you promote into the stacked widget?

                                  M Offline
                                  M Offline
                                  marlenet15
                                  wrote on 12 Oct 2015, 18:03 last edited by
                                  #24

                                  @mrjj pages in a stackedwidget. I figured it out how to make it work through code but I am having a difficult time make it work only through Qt Designer/.ui file

                                  M 1 Reply Last reply 12 Oct 2015, 18:07
                                  0
                                  • M marlenet15
                                    12 Oct 2015, 18:03

                                    @mrjj pages in a stackedwidget. I figured it out how to make it work through code but I am having a difficult time make it work only through Qt Designer/.ui file

                                    M Offline
                                    M Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on 12 Oct 2015, 18:07 last edited by
                                    #25

                                    @marlenet15
                                    Ok. well I think such wizard do need code if not just a Dialog with a stacked widget and the the Next button outside of the stacked.

                                    1 Reply Last reply
                                    0
                                    • K Offline
                                      K Offline
                                      koahnig
                                      wrote on 12 Oct 2015, 18:32 last edited by
                                      #26

                                      @marlenet15 @mrjj

                                      You can connect 2 signals.

                                      Vote the answer(s) that helped you to solve your issue(s)

                                      M 1 Reply Last reply 12 Oct 2015, 19:30
                                      0
                                      • K koahnig
                                        12 Oct 2015, 18:32

                                        @marlenet15 @mrjj

                                        You can connect 2 signals.

                                        M Offline
                                        M Offline
                                        mrjj
                                        Lifetime Qt Champion
                                        wrote on 12 Oct 2015, 19:30 last edited by
                                        #27

                                        @koahnig
                                        yeah but not sure how it helps ?
                                        Can you explain more about the setup?

                                        K 1 Reply Last reply 12 Oct 2015, 20:15
                                        0
                                        • M mrjj
                                          12 Oct 2015, 19:30

                                          @koahnig
                                          yeah but not sure how it helps ?
                                          Can you explain more about the setup?

                                          K Offline
                                          K Offline
                                          koahnig
                                          wrote on 12 Oct 2015, 20:15 last edited by
                                          #28

                                          @mrjj

                                          Instead of the SLOT macro you use another SIGNAL macro.

                                           bool boo = connect (ptrFirst, SIGNAL (mySigFirst() ), this, SIGNAL ( newSignal() ) );
                                          

                                          That is useful when you simply have to pass on a signal. It saves you to create a slot in your class which simply is emitting a signal.

                                          the text in the signal & slot explanatory part below the graph and shortly before the heading Signals is
                                          You can connect as many signals as you want to a single slot, and a signal can be connected to as many slots as you need. It is even possible to connect a signal directly to another signal. (This will emit the second signal immediately whenever the first is emitted.)

                                          In the form of the example above I have used it already.

                                          Vote the answer(s) that helped you to solve your issue(s)

                                          1 Reply Last reply
                                          0

                                          18/31

                                          12 Oct 2015, 17:02

                                          • Login

                                          • Login or register to search.
                                          18 out of 31
                                          • First post
                                            18/31
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved