The way to do this is-
- Create an out-of-source directory - let's call it "templates" (can be anything)
- Copy the AndroidManifest.xml into "templates" from -
<path to qt installation>/android_armv7/src/android/templates/AndroidManifest.xml
- Edit the copied AndroidManifext.xml with your favorite editor and change the orientation from "unspecified" to "sensorLandscape" (or anything else you prefer) and save the file.
In the qmake file (*.pro) of your project, add the following line -
ANDROID_PACKAGE_SOURCE_DIR = <path to your templates directory>
#in case you added the directory one above the source directory, path to your templates directory = "../templates"
Build and Run. You should now see that the Orientation is fixed to whatever you have specified in the custom AndroidManifest.xml file
To understand what really is happening - here's the qt reference, look for ANDROID_PACKAGE_SOURCE_DIR
In case the link doesn't work in future, here's the relevant bits -
"ANDROID_PACKAGE_SOURCE_DIR: This variable can be used to specify a
directory where additions and modifications can be made to the default
Android package template. The androiddeployqt tool will copy the
application template from Qt into the build directory, and then it
will copy the contents of the ANDROID_PACKAGE_SOURCE_DIR on top of
this, overwriting any existing files. The update step where parts of
the source files are modified automatically to reflect your other
settings is then run on the resulting merged package. If you, for
instance, want to make a custom AndroidManifest.xml for your
application, then place this directly into the folder specified in
this variable. You can also add custom Java files in
ANDROID_PACKAGE_SOURCE_DIR/src."
QtCreator - 4.2.1, Qt - 5.8