Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. PathView and screen size

PathView and screen size

Scheduled Pinned Locked Moved Solved Mobile and Embedded
pathviewscreen rotationresizeqmlqt quick
3 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EtaPhi
    wrote on 21 Feb 2016, 14:46 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ekkescorner
      Qt Champions 2016
      wrote on 22 Feb 2016, 10:28 last edited by
      #2

      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
      C++

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

      QML

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

      this should work inside the PathView

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.8 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      1 Reply Last reply
      1
      • E Offline
        E Offline
        EtaPhi
        wrote on 23 Feb 2016, 05:00 last edited by
        #3

        It works!
        I'm very grateful to you.

        1 Reply Last reply
        0

        1/3

        21 Feb 2016, 14:46

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved