I created a Qt/QML application and ported the application to Android. Now I'm able to run the application on the Android device. I want to fix the orientation mode to Landscape.
I manually edited the AndroidManifest.xml
and set the android:screenOrientation="unspecified"
to android:screenOrientation="sensorLandscape"
<activity
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
android:name="org.qtproject.qt5.android.bindings.QtActivity"
android:label="Engage"
android:screenOrientation="sensorLandscape"
android:launchMode="singleTop">
Each time when I deploy the project, the manifest is overwritten and reset to android:screenOrientation="unspecified"
I got a solution for this.
Add a folder in your project folder. I have named 'android-sources'. Copy your
AndroidManifest.xml
from android-build and paste to 'android-sources' folder. Open .pro file and add the followingThen open the
AndroidManifest.xml
change the orientation
On Qt Forum the following solution is suggested:
Just go to the projects, running, click on details and create androidmanifest.xml, choose a directory. After that add it to your project if it didnt happen automatically and edit it. 4th line should look like this:
just change "unspecified" to "sensorLandscape" and save it.
It won't be overwritten every time you deploy.