Qt6 topics merged with General

PathView and screen size

  • Hello,
    I'm trying to change the path along which a PathView places list items according to screen size changes.
    For instance, when a user rotates its phone, the path should use all available space.
    This behaviour is also useful to handle different mobile devices (eg. iPhone4, iPhone5, iPhone6 and iPads) whose display resolution is different.
    Traditional desktop Qt applications (I mean the ones which use widgets) can override QResizeEvent to react to window size changes, but it seems that this strategy isn't available in QtQuick, since there is no onResize handler.
    I already use layout managers to handle placement and size of QtQuick controls, but they can't modify the path inside a PathView so that it's still centered when a PathView size changes.
    Any suggestion will be welcomed.

  • Qt Champions 2016

    don't know if I understand your problem right (I'm just eavluating Qt)
    so probably there are other ways to detect

    you can try this as an easy way to detect if the screen size changed

        QQmlContext* context = engine.rootContext();
        context->setContextProperty("myScreen", qApp->primaryScreen());


        property int screenWidth: myScreen.size.width
        onScreenWidthChanged: {
            // do your stuff

    this should work inside the PathView

  • It works!
    I'm very grateful to you.