I've been searching for a solution to this but I could only find a way to force the whole app to stay in either landscape or portrait, via the android manifest. In my app the user is able to customize his UI and one important aspect of that is the screen orientation. I'd like to create a button where the user could change the orientation and lock it that way.
Thank you for your time.
答案 0 :(得分:0)
I don't think it is possible through QML
but you may bind your qml button to change orientation by setting orientation of QQmlApplicationViewer
object.
You may find some information here.
In my experience I remember I forced orientation only in C++
.
So, you may need a class to export to QML
which will toggle orientation (by setting value to the QQmlApplicationViewer
and bind it with your button/checkbox in your qml interface.