Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Screen incorrect properties at application start up
Qt 6.12 LTS is out! See what's new in the release blog

QML Screen incorrect properties at application start up

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.4k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I need correct screen sizes at start but if i do this code:

    @import QtQuick 2.0
    import QtQuick.Window 2.0

    Rectangle {

    MouseArea {
        anchors.fill: parent
        onClicked: {
            console.log( Screen.height, Screen.width, Screen.desktopAvailableHeight, Screen.desktopAvailableWidth);
        }
    }
    
    Component.onCompleted: {
        console.log( Screen.height, Screen.width, Screen.desktopAvailableHeight, Screen.desktopAvailableWidth);
    }
    

    }
    @

    i have zeros at start
    and correct screen sizes at mouse click

    @0 0 0 0
    1200 1920 1133 1920@

    How can tell what is this?
    And how i can get correct screen sizes at start of application?

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      The answers are in the "QML screen docs":http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick-window2-screen.html#details

      Qt Certified Specialist
      www.edalsolutions.be

      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
      • Unsolved