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

signal and slots between two classes

Scheduled Pinned Locked Moved General and Desktop
31 Posts 5 Posters 11.1k 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.
  • mrjjM mrjj

    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 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.

    mrjjM 1 Reply Last reply
    0
    • M marlenet15

      @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.

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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
      0
      • mrjjM mrjj

        @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 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

        mrjjM 1 Reply Last reply
        0
        • M marlenet15

          @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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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 last edited by
            #26

            @marlenet15 @mrjj

            You can connect 2 signals.

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

            mrjjM 1 Reply Last reply
            0
            • K koahnig

              @marlenet15 @mrjj

              You can connect 2 signals.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #27

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

              K 1 Reply Last reply
              0
              • mrjjM mrjj

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

                K Offline
                K Offline
                koahnig
                wrote on 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
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #29

                  @mrjj It's called signal forwarding. It's used mainly to avoid creating slots that just re-emits the same signal one class upper.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #30

                    Thank you :)
                    I can see it gives cleaner code if a slot is not really needed.

                    1 Reply Last reply
                    0
                    • M marlenet15

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

                      JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote on last edited by
                      #31

                      @marlenet15 said:

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

                      Your code shows that signin inherits QDialog, not QStackedWidget. So, I don't think you can promote a QStackedWidget to a Signin... Did you change your C++ code after you added QStackedWidget?

                      so that later I can use it so that when i click the button, it goes to the next page.

                      I suggest using QWizard, not a QStackedWidget

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

                      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