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
Forum Updated to NodeBB v4.3 + New Features

Calling variables declared through Qt designer

Scheduled Pinned Locked Moved Qt Creator and other tools
10 Posts 5 Posters 4.6k 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.
  • F Offline
    F Offline
    freecamellia
    wrote on 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 last edited by
      #2

      Why you do not like
      @ui->@

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on 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 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 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 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 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 last edited by
                  #8

                  freecamellia
                  it’s heavy for writing code?

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    freecamellia
                    wrote on last edited by
                    #9

                    Yes, for me!

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fguimaraes
                      wrote on 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

                      • Login

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