Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    [solved] automatically anchor elements when phone rotates

    Mobile and Embedded
    3
    7
    2122
    Loading More Posts
    • 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
      pascal95abc last edited by

      Hello,

      I created a new Qt Widget Project -> Mobile Qt Application and want to automatically apply this code to anchor the pushbutton always when the phone rotates (I have ScreenOrientationAuto, btw.)

      @ui->pushButton->setGeometry(0,0,ui->centralWidget->width(),ui->centralWidget->height() / 2);@

      Thank you

      Qt 4.7.3
      Symbian OS v9.4 / Symbian^1, S60 5th Edition
      on N97

      1 Reply Last reply Reply Quote 0
      • T
        tobias.hunger last edited by

        If you are using QWidgets, then this is the wrong forum:-)

        QWidgets can to do the anchoring that QML does. You can archive this effect using a layout though.

        1 Reply Last reply Reply Quote 0
        • P
          pascal95abc last edited by

          Yes, I am using QWidgets in this project now.

          Can you tell me a forum to ask about Layout for anchoring ?
          Edit: I now found the layout thing in the designer, but I still need a forum to ask questions about things conserning QWidget.

          Qt 4.7.3
          Symbian OS v9.4 / Symbian^1, S60 5th Edition
          on N97

          1 Reply Last reply Reply Quote 0
          • M
            mlong last edited by

            Moved to Mobile & Embedded (although it could have been General/Desktop.)

            Software Engineer
            My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

            1 Reply Last reply Reply Quote 0
            • P
              pascal95abc last edited by

              Can I also work with ratios, like if I have two parts, that the first part takes 80% and the rest 20% ? How to set that ?

              Qt 4.7.3
              Symbian OS v9.4 / Symbian^1, S60 5th Edition
              on N97

              1 Reply Last reply Reply Quote 0
              • M
                mlong last edited by

                "Layouts":/doc/qt-4.8/layout.html will give you the functionality you're looking for. (Look at "Stretch Factors" for percentage widths.)

                Software Engineer
                My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                1 Reply Last reply Reply Quote 0
                • P
                  pascal95abc last edited by

                  This looks appropiate. Thanks for the help, and now I also know where to find the forum.

                  Qt 4.7.3
                  Symbian OS v9.4 / Symbian^1, S60 5th Edition
                  on N97

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post