After the successful compilation, there will be a android-build directory, the directory has a androidmanifest.xml file;
Build an Android folder in the project directory and put the Androidmanifest.xml into the Android folder;
Add the following phrase to the Pro:
Android_package_source_dir=$$PWD/android
Then modify the androidmanifest.xml file:
- android:screenorientation = "Landscape"
The direction the activity displays in the screen. The property value can be one of the values listed in the following table:
"unspecified" |
Default value, the system selects the direction. Its use policy, and because of the specific context of the selection, may vary depending on the device. |
"user" |
Use the user's current preferred orientation. |
"behind" |
Use the same direction in the activity stack as the activity under that activity. |
"landscape" |
Horizontal display (width is larger than height) |
"portrait" |
Portrait display (height is larger than width) |
"reverseLandscape" |
In contrast to the normal horizontal direction, it is introduced in API level 9. |
"reversePortrait" |
In contrast to the normal longitudinal direction, it is introduced in API level 9. |
"sensorLandscape" |
Horizontal display, but based on the device sensor, can be displayed in normal direction, or reverse display, in the API Level 9 is introduced. |
"sensorPortrait" |
Vertical display, but based on the device sensor, can either be displayed in normal direction, or reverse display, in the API Level 9 is introduced. |
"sensor" |
The direction of the display is determined by the direction sensor of the device. The display direction depends on how the user holds the device, and the direction of the display changes when the user rotates the device. However, by default, some devices do not rotate in all four directions, so to allow rotation in all four directions, use the Fullsensor property value. |
"fullSensor" |
The direction of the display (4 directions) is determined by the direction sensor of the device, except that it allows the screen to have 4 display orientations, and the other is similar to when set to "sensor", which is usually done regardless of the device. For example, some devices typically do not use portrait or landscape inversion, but this setting will still cause such reversals. This value is introduced in API level 9. |
"nosensor" |
The display direction of the screen does not refer to the physical direction sensor. The sensor is ignored, so the display does not rotate because the user is moving the device. In addition to this difference, the system rotates the orientation of the screen with the same policy as the "unspecified" setting. |
You can open the androidmanifest.xml file in Qt and directly modify the program's icon
QT Development Android Setting icon and horizontal screen