Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Problem getting Screen.desktopAvailableHeight when Component.onCompleted
Forum Updated to NodeBB v4.3 + New Features

Problem getting Screen.desktopAvailableHeight when Component.onCompleted

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 890 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    story1225
    wrote on last edited by
    #1

    I have an common listview control just like the 'LauncherList' in Qt examples, and adding items at Component.onCompleted. Every item's height is depending on the app window height which is same with Screen.desktopAvailableHeight.

    But in Qt Doc, it said 'Screen type is not valid at Component.onCompleted, because the Item or Window has not been displayed on a screen by this time'.

    I have tested on some android devices. Some device can get Screen.desktopAvailableHeight value at Component.onCompleted, but Nexus 7 can not.

    Is there any way I can add items just like in Component.onCompleted ?
    Sorry for my poor English.
    Thanks!

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      If you are using a Loader to load a component you can bind the "active":http://qt-project.org/doc/qt-5/qml-qtquick-loader.html#active-prop property to Component.Ready state thus ensuring it will load when main component is ready.
      Or you can just use a Timer element with a small delay to call some function which will further create the remaining objects.

      157

      1 Reply Last reply
      0
      • S Offline
        S Offline
        story1225
        wrote on last edited by
        #3

        I see.
        Thank you. :)

        1 Reply Last reply
        0

        • Login

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