Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Calling variables declared through Qt designer

Calling variables declared through Qt designer

Scheduled Pinned Locked Moved Qt Creator and other tools
10 Posts 5 Posters 4.3k 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.
  • F Offline
    F Offline
    freecamellia
    wrote on 26 Nov 2011, 09:49 last edited by
    #1

    Hi,
    In .cpp file, how can I call variables declared through Qt designer without put @ui->@ before them.
    Sorry for the english I speak.

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on 26 Nov 2011, 09:56 last edited by
      #2

      Why you do not like
      @ui->@

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Eddy
        wrote on 26 Nov 2011, 09:58 last edited by
        #3

        In case you need to use the same variable a lot through ui-> you could pass it to another variable first. And use that new variable instead.

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qxoz
          wrote on 26 Nov 2011, 10:07 last edited by
          #4

          And yet.
          Sorry for the molestation, I it's just interesting for me, where it might be useful?

          1 Reply Last reply
          0
          • F Offline
            F Offline
            freecamellia
            wrote on 26 Nov 2011, 10:11 last edited by
            #5

            @qxoz it's heavy!
            @Eddy It's a good idea, thanks!

            1 Reply Last reply
            0
            • F Offline
              F Offline
              freecamellia
              wrote on 26 Nov 2011, 10:20 last edited by
              #6

              [quote author="qxoz" date="1322302074"]And yet.
              Sorry for the molestation, I it's just interesting for me, where it might be useful?[/quote]

              No problem, we learn together!

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on 26 Nov 2011, 10:22 last edited by
                #7

                If you really want, you can also make your class inherit the ui class: the "multiple inheritance approach":http://doc.qt.nokia.com/4.7/designer-using-a-ui-file.html#the-multiple-inheritance-approach . That will get rid of the ui-> dereference as well.

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  qxoz
                  wrote on 26 Nov 2011, 15:29 last edited by
                  #8

                  freecamellia
                  it’s heavy for writing code?

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    freecamellia
                    wrote on 26 Nov 2011, 17:18 last edited by
                    #9

                    Yes, for me!

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fguimaraes
                      wrote on 28 Nov 2011, 16:32 last edited by
                      #10

                      It's not clear for me, from where do you want to access this variable?

                      Birth, death, rebirth, though, and constantly progress, that is the law.

                      1 Reply Last reply
                      0

                      1/10

                      26 Nov 2011, 09:49

                      • Login

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