Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to run QML application for both portrait and landscape with example
Forum Updated to NodeBB v4.3 + New Features

How to run QML application for both portrait and landscape with example

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 4 Posters 2.3k Views 2 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.
  • D Offline
    D Offline
    dhu0504
    wrote on last edited by
    #1

    Can any one of you tell how can i run simple qt qml application for both portrait and landscape. It will be very helpful give some idea about that

    J.HilkJ 1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I think you need to define a bit more what you want to achieve. Qt QML applications automatically handle portrait/ landscape modes on mobile devices (iOS, Android). What you need to make sure about is to set up the UI properly (using Layouts or anchors), so that is can resize nicely when window size is changed.

      (Z(:^

      1 Reply Last reply
      3
      • D Offline
        D Offline
        dhu0504
        wrote on last edited by
        #3

        I added images in the QML design. How to handle in portrait and landscape mode.

        P sierdzioS 2 Replies Last reply
        0
        • D dhu0504

          I added images in the QML design. How to handle in portrait and landscape mode.

          P Offline
          P Offline
          pra7
          wrote on last edited by
          #4

          @dhu0504 Can you show some code ?

          1 Reply Last reply
          0
          • D dhu0504

            I added images in the QML design. How to handle in portrait and landscape mode.

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            @dhu0504 said in How to run QML application for both portrait and landscape with example:

            I added images in the QML design. How to handle in portrait and landscape mode.

            But what do you mean by "handle"? How should the images behave? Does it work incorrectly for you? If yes, please share your code so we can analyse it. Otherwise we can only guess.

            (Z(:^

            1 Reply Last reply
            0
            • D dhu0504

              Can any one of you tell how can i run simple qt qml application for both portrait and landscape. It will be very helpful give some idea about that

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @dhu0504
              if you want to know how you can detect portait/landscape mode in qml theres a way.

              If you know you're on a mobile device!!!

              import QtQuick.Window 2.2
              
              property bool portaitMode: Screen.desktopAvailableHeight > Screen.desktopAvailableWidth
              onPortaitModeChanged: console.log(portaitMode ? "Portait" : "Landscape")
              

              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              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