Qt设置iOS屏幕方向

Kyl*_*ray 5 c++ qt qml ios

在Qt中使用跨平台应用程序。我需要能够强制几个页面的屏幕方向。我找到了一种针对Android的方法,但是找不到针对iOS的任何方法。

有什么方法可以在iOS中强制设置屏幕方向?

更好的是,是否有一个呼叫可以为任何给定的移动平台设置屏幕方向?

谢谢!

小智 0

看看这里:

https://doc.qt.io/qt-5/qml-qtquick-window-screen.html#orientation-attached-prop

您可以将 Screen.orientation (或 Screen.primaryOrientation)属性写入您自己的属性中,并使用 onChanged 事件处理程序来获取信号,例如:

readonly property var screenOrientation: Screen.orientation

onScreenOrientationChanged: {
console.log("Orientation Changed!")
}
Run Code Online (Sandbox Code Playgroud)