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. Slots and Signals

Slots and Signals

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 791 Views
  • 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.
  • P Offline
    P Offline
    Paklosha
    wrote on last edited by
    #1

    I started learning qt 4.8, but I just can’t figure out the signals and slots. How can I switch between two buttons with the third one?

    J.HilkJ 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi and welcome to the forums
      Each button sends the signal clicked(). (amount others)
      That signal can be connected to a slot. One slot for each button or
      all buttons to the same slot.

      What do you mean by

      • How can I switch between two buttons with the third one?

      What should happen when you click the third one?
      Im not sure what the switching part means.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Paklosha
        wrote on last edited by
        #3

        when I click on the third button, the first one is pressed then the second.I meant it

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi and welcome to devnet,

          Do you mean QPushButton one and two are toggle buttons and you want to switch their state with QPushButton three ?

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

          P 1 Reply Last reply
          0
          • P Offline
            P Offline
            Paklosha
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi and welcome to devnet,

              Do you mean QPushButton one and two are toggle buttons and you want to switch their state with QPushButton three ?

              P Offline
              P Offline
              Paklosha
              wrote on last edited by
              #6

              @SGaist I want to switch their state with QPushButton three

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Then connect your third button to a slot where you do that. To know which button to toggle, use a variable that stores the last modified button. Then change each time based one that.

                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
                3
                • P Paklosha

                  I started learning qt 4.8, but I just can’t figure out the signals and slots. How can I switch between two buttons with the third one?

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  hi @Paklosha

                  out of curiosity why do you learn qt4 and not qt5.

                  the last version of qt4 was released 2011, It is quite outdated by todays standards.


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  2

                  • Login

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