0

I am trying to write a Qt Widgets application in Qt Creator 10.0.2 for Android under Ubuntu 22.04. I use the CMake build system, the "Android Qt 6.5.1 Clang armeabi-v7a" kit, with build-tools version 31.0.0 and build platform SDK android-34.

I want to make the app always landscape, so I need to change the screenOrientation option in the AndroidManifest.xml file to landscape. So I changed the manifest file (project folder)/build-(project name)-Android_Qt_6_5_1_Clang_armeabi_v7a-Debug/android-build/AndroidManifest.xml. But when I run the application, the screen is still portrait. I saw that the manifest file got overwritten and the orientation setting becomes unspecified again.

I've seen the answers given in Landscape mode in Qt-Android application. Apparently the solutions there are obsolete. The current Qt Creator doesn't make a .pro file, and Projects > Run doesn't appear to have an option for creating the manifest file.

As for the answer by Zappy Mans (actually from https://doc.qt.io/qtcreator/creator-deploying-android.html), I've followed it (clicked the Create Templates button and provided a path) but the error Could not update the project file (project path)/(project name) appeared. It actually creates a manifest file in the path I provided, but it's not used. It appears that (project folder)/build-(project name)-Android_Qt_6_5_1_Clang_armeabi_v7a-Debug/android-build/AndroidManifest.xml is still used, and it's overwritten every time I click Run.

Any idea how to make a permanent change to the manifest file which is actually used? I'm stuck here.

As for the minimum reproducible example, just create a new Qt Widgets application project, put a button somewhere to check the orientation, and click Run. Then attempt the modifications that I made.

user351579
  • 129
  • 6

0 Answers0