Qt World Summit: Submit your Presentation

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

    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:

    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

    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

  • I'm facing the same issue, I have a user-specific browser and the address will appear on swipe from the top edge.
    But when I rotate the screen, the web engine rotates perfectly but the address bar sticks at the same position in 0 deg or landscape.
    How to rotate the drawer along with the other components. I'm using Qt 5.15 in which I have to play with QML, instead of windowing rotate of the whole system
    @dbrown: did you resolve this issue and how, please suggest.
    @raven-worx: app drawer positioning is also not working.
    Thanks in advance.

Log in to reply