Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [solved] automatically anchor elements when phone rotates

[solved] automatically anchor elements when phone rotates

Scheduled Pinned Locked Moved Mobile and Embedded
7 Posts 3 Posters 2.5k 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
    pascal95abc
    wrote on last edited by
    #1

    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
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      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
      0
      • P Offline
        P Offline
        pascal95abc
        wrote on last edited by
        #3

        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
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          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
          0
          • P Offline
            P Offline
            pascal95abc
            wrote on last edited by
            #5

            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
            0
            • M Offline
              M Offline
              mlong
              wrote on last edited by
              #6

              "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
              0
              • P Offline
                P Offline
                pascal95abc
                wrote on last edited by
                #7

                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
                0

                • Login

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