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. All my QML applications won't get rotated properly on Android
Forum Updated to NodeBB v4.3 + New Features

All my QML applications won't get rotated properly on Android

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 2 Posters 1.7k 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.
  • A Offline
    A Offline
    Alaa Elrifaie
    wrote on last edited by
    #1

    Hi there,

    I've been developing a lot of small applications lately in QML to learn it & get used to its syntax.

    It's working properly on Desktop, but on Android I have a rotation-issue.

    When the application is launched while the device is in landscape or portrait mode it's rendered perfectly! But when the device is rotated, it get's messed like if it isn't re-rendering. Check screenshots:
    

    The 1st screenshot: ( When the application is launched while in landscape mode ).

    The 2nd screenshot: ( When rotating the device while the app is up & running after it was launched in landscape mode ).

    The 3rd screenshot: ( When the application is launched in portrait mode ).

    The 4th screenshot: ( When device gets rotated & the app was launched in portrait mode from beginning ).

    [ "Click here to view in full size":http://store1.up-00.com/2014-07/1406287874491.png ]
    !http://www.up-00.com/thumbs/1406287874491.png(When the application is launched while in landscape mode)!

    [ "Click here to view in full size":http://store1.up-00.com/2014-07/140628787482.png ]
    !http://www.up-00.com/thumbs/140628787482.png(When rotating the device while the app is up & running after it was launched in landscape mode)!

    [ "Click here to view in full size":http://store1.up-00.com/2014-07/1406287875033.png ]
    !http://www.up-00.com/thumbs/1406287875033.png(When the application is launched in portrait mode)!

    [ "Click here to view in full size":http://store1.up-00.com/2014-07/1406287875314.png ]
    !http://www.up-00.com/thumbs/1406287875314.png(When device gets rotated & the app was launched in portrait mode from beginning)!

    I'm using an ApplicationWindow as my root item in my QML file ( if it matters ):
    @ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    }@

    .. So, what's the problem?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gabrieltb
      wrote on last edited by
      #2

      bq. width: 640
      height: 480

      I think that is the hardcoded width/height.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Alaa Elrifaie
        wrote on last edited by
        #3

        [quote author="gabrieltb" date="1406299078"]bq. width: 640
        height: 480

        I think that is the hardcoded width/height.[/quote]

        It should be hardcoded or it won't appear at all.
        But the weird thing is that it's rendered correctly at initial launch, problem occurs after rotation.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gabrieltb
          wrote on last edited by
          #4

          I apologize for my lazy answer. What I meant is that you can try using relative values for width and height.

          @width: Screen.width
          height: Screen.height@

          Also, take a look "here":http://qt-project.org/doc/qt-5/scalability.html
          You'll find a section talking about screen orientation.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Alaa Elrifaie
            wrote on last edited by
            #5

            [quote author="gabrieltb" date="1406310520"]I apologize for my lazy answer. What I meant is that you can try using relative values for width and height.

            @width: Screen.width
            height: Screen.height@

            Also, take a look "here":http://qt-project.org/doc/qt-5/scalability.html
            You'll find a section talking about screen orientation.[/quote]
            Worked!

            Thank you so much budd :)

            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