Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Drawer not rotating with the rest of the scene



  • Hello,

    I writing a QML app with Qt 5.10 on a Raspberry Pi with a 7" touchscreen. The screen is rotated in the "portrait" orientation (270 degrees).

    I have the screen display and touchscreen rotation happening correctly. I wrapped the items in a Page component and set the "rotation" property and this is working great.

    But, when I open the Drawer component by tapping the menu button, it opens as you would expect in "landscape" orientation. It does not seem like the rotation is applying to the Drawer even though it is within the Page component. I was able to reproduce this on the desktop by slightly modifying the "gallery" example project to display in portrait orientation.

    I must be missing something. Does anyone have any suggestions to try? Thanks for the help.


  • Moderators

    @dbrown
    i guess the drawer is bound to the window.
    But what happens when you bind the drawer edge value to your scene rotation accordingly?



  • @raven-worx
    Thanks for the quick response.

    I assigned the "edge" property to all 4 enum values and observed the behavior:
    Qt.TopEdge
    Qt.LeftEdge
    Qt.RightEdge
    Qt.BottomEdge

    It has the effect of moving what edge the drawer displays from, but it is still in the "landscape" orientation.

    I also noticed that the Dialog component is behaving the same way -- it shows only in the "landscape" orientation.

    I think you are right that it is bound to the window. But I can't seem to figure out how to apply the rotation to the window. The root ApplicationWindow component does not have the "rotation" property. I also changed the root object to be an Item and set the rotation, but it did not change the behavior either. I'm still researching this...

    Thanks again for your help.


  • Moderators

    @dbrown
    what about Window's orientation property (set it to Qt::PortraitOrientation)?

    Alternatively it would be easier to rotate the screen on system level and do not worry about rotations in QML.



  • Found an easy way to avoid the Drawer shift to weird position when changed from portrait to landscape.

    position: root.parent.width < root.parent.height ? 1 : 1


Log in to reply