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. Landscape Mode
QtWS25 Last Chance

Landscape Mode

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 4 Posters 4.0k 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.
  • O Offline
    O Offline
    oasacorp
    wrote on last edited by
    #1

    Well I am really new to Qt. I am develping for Nokia N8. I am designing a calculator. Everything is fine untill I rotate it in the simulator or on my device. After rotation the ui is all messed up. Is there a way to relayout the ui or better design another UI and when the device rotates it changes to the other. I cant find anywhere, how the ui looks in Landscape mode while working in DESIGNER Mode. This is important because I have some advertisement to display at the lower part from an aviation "website":http://magicofflight.com I am completely new to this. Any help appreciated. I googled it around but can only find resizing via code. Also please let me know how the orientation change is identified. If there is no way other than using code to relayout, advice me the necessary steps to make it as simple as possible. Any help is greatly appreciated and will be acknowledged. Thank You !

    1 Reply Last reply
    0
    • O Offline
      O Offline
      oasacorp
      wrote on last edited by
      #2

      I forgot to mention. My Designing platform is Windows 7 and is using default Qt Creator 2.01

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fcrochik
        wrote on last edited by
        #3

        One generic approach to the problem is to process the "resize event":http://doc.qt.nokia.com/latest/qwidget.html#resizeEvent

        Most likely you will need to have two quite different layouts if you really want to optimize the use of the screen. Depending on your layout you may want to skip the designer and layout the components "by hand".

        Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Fuzzbender
          wrote on last edited by
          #4

          AFAIK, there is no "rotation event" (QDeskTopWidget just resizes), but due to style implementation, a StyleChanged event is raised. You might want to listen for that event.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kamalakshantv
            wrote on last edited by
            #5

            As mentioned above by fcrochik make use of the resize event. Also if required you can also lock the orientation to one particular mode.

            1 Reply Last reply
            0
            • O Offline
              O Offline
              oasacorp
              wrote on last edited by
              #6

              Thank you all for the reply. But its really really sad that you cant actually design it visually. I have like so many buttons and to position the x,y cordinate will really be boring :| . Any better way to do ? No i dont want to lock. Actually in landscape i want more buttons (some scientific options), so does that mean i have to create those buttons in realtime ? :| (P.S I am newbie)>

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Fuzzbender
                wrote on last edited by
                #7

                How about making a separate UI design for landscape and switch the design (the .ui file) when device rotates?

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fcrochik
                  wrote on last edited by
                  #8

                  [quote author="oasacorp" date="1296564709"]Thank you all for the reply. But its really really sad that you cant actually design it visually. I have like so many buttons and to position the x,y cordinate will really be boring :| . Any better way to do ? No i dont want to lock. Actually in landscape i want more buttons (some scientific options), so does that mean i have to create those buttons in realtime ? :| (P.S I am newbie)> [/quote]

                  Independently of the landscape/rotate issue you should try to avoid "positioning" components using arbitrary positions. The right approach is to use the Layout Classes (Vertical, Horizontal, Grid, Form) so the actual components position is calculated automatically, respecting style, fonts, skin and others.

                  As someone suggested, if you really want to use the designer, you can create two separate ui files and load them using the "QUILoader":http://doc.qt.nokia.com/latest/quiloader.html

                  Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

                  1 Reply Last reply
                  0
                  • O Offline
                    O Offline
                    oasacorp
                    wrote on last edited by
                    #9

                    Thanks again. I would like to do that, as in create another ui and then load. After looking through the documentation, I realize the #include <QUiLoader> is not present :'( . Also how to trigger if its in landscape mode , shoud i compare width and height ? but how often :'(. Also please advise how to use Quiloader. By code, i did not understand Layout Classes. Any tutorials would be highly appreciated. Thank You.

                    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