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. How to access a member of a QButtonGroup by number?
Forum Updated to NodeBB v4.3 + New Features

How to access a member of a QButtonGroup by number?

Scheduled Pinned Locked Moved General and Desktop
17 Posts 4 Posters 6.9k 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.
  • A Offline
    A Offline
    Anna
    wrote on last edited by
    #8

    @mods: could you "unsolve" this thread, please?
    or should I start a new topic?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #9

      typically, a new question should have a new thread, but in your case:

      which type has ui->widget ???

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anna
        wrote on last edited by
        #10

        Gerolf,
        it is a gui. you already helped me with creating this gui in this thread:
        http://developer.qt.nokia.com/forums/viewthread/9706

        what's the correct approach to get the ID?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #11

          I meant a class name. does the class that ui->widget points to has the slot setSpielTag? is it of type Display?

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Anna
            wrote on last edited by
            #12

            right, it's the type Display...

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #13

              do you get some error or warnign output in the debugger or on the console?

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Anna
                wrote on last edited by
                #14

                the direct access from the class display doesn't work (I can't even select the andon class variable, of course)
                and the slot thing doesn't work either. my app stops as there is a silly value for t, so it wasn't set by the signal)

                but I'd really rather write a get function or something like this in order to access this member variable, as this seems to be a useful thing to learn ;)
                how would that work?

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on last edited by
                  #15

                  This is really basic C++. You should use a book for that.
                  If you need a getter, make the ButtoGroup pointer a member of the class and access it in the getter.

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Anna
                    wrote on last edited by
                    #16

                    gerolf, the advice to use a book I already got it a few posts earlier and I agree with it. this is something I already know even without the first time telling me.
                    what I don't know is how to solve my problem. so what would be really useful to me is probably an example how I could implement the getter.

                    maybe someone can give me one?

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

                      Off-topic:
                      The point of helping for many people here (ok, at least for me, let me not pretend to speak for others here) is that it is a learning experience for everyone involved. Feeding you complete answers, also on non-Qt issues, does not qualify as such. That is why Gerolf and I suggest you learn C++ before trying your hand at Qt.

                      I am sorry you have a deadline in a language and toolkit you know very little about, but that is your problem, not ours. Personally, I would have invested in a paid consultant for a situation like that. That would get you straight answers and timely responses, and ready-to-use pieces of code.

                      On-topic then:
                      Make Tag a property on the class: a private variable to keep the value (you could perhaps use your button group itself for that), a getter method to retreive the value, and a setter method to set it. The getter method will return the value of your private variable, while the setter one will manipulate its value (and its representation, if that is separate from each other). Optionally, you can add a changed signal for the value, to let other objects know that the value has been changed.

                      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