How to run QML application for both portrait and landscape with example
-
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.
-
@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.
-
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
@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")