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. Screen class properties problem in QML documents
Qt 6.11 is out! See what's new in the release blog

Screen class properties problem in QML documents

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 1 Posters 2.6k 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.
  • AlicemirrorA Offline
    AlicemirrorA Offline
    Alicemirror
    wrote on last edited by
    #1

    Hi,
    after a set of tests with the debug on simulator and a couple of Symbian^3 devices over a Windows 7 platform I have found a Issue in the Screen class of the last Qt SDK package.
    The development environment is the following: Qt SDK 1.1.3 + Qt 4.7.4 + Qt Creator 2.3.0:
    @
    Window {
    id: window

    // Test point - one of the following two lines alternate.
    width: Screen.width
    

    // width: Screen.displayWidth

    PageStack {
        id: pageStack
        anchors {
            left: parent.left;
            right: parent.right;
            top: parent.top
            bottom: parent.bottom
        }
    }
    
    Component.onCompleted: {
        pageStack.push(Qt.resolvedUrl("MainPage.qml"))
    }
    

    }
    @
    The assignement of the value results always 0. width and height are shown as type real and these Screen properties in the documentation are shown as type int (I think compatible values). There are no errors at runtime but the value is always 0.

    About Screen.height (and relative width property) the documentation reports:

    bq. The screen height in pixels. The value changes when the orientation changes: in the portrait mode the height is bigger than width and in the landscape mode vice versa.

    About Screen.displayHeight (and relative displayWidth property) the documetation reports:

    bq. The native height of the display, that is, the height of the screen when rotation returns zero.

    There are not notes about these values if they can't be assigned explicitly to the size of an object. In the axample above I have used the Window element of the main.qml page but I have applied the same assignation to other Page QML documents with the same result. Same results also when using these values to check the actual width / height of a object to resize some elments in it depending by the actual device orientation.

    It seems that these four values are always 0 in all cases. Is there something that I missed?

    Enrico Miglino (aka Alicemirror)
    Balearic Dynamics
    Islas Baleares, Ibiza (Spain)
    www.balearicdynamics.com

    1 Reply Last reply
    0
    • AlicemirrorA Offline
      AlicemirrorA Offline
      Alicemirror
      wrote on last edited by
      #2

      keeping more unreadable the means of this class there is the code snipped example in the same Screen element documentation:

      bq. You can use the property to lock the screen to a certain orientation. The following code example locks the screen to the landscape orientation.
      @
      function lockToLandscape() {
      screen.allowedOrientation = Screen.Landscape
      }
      @

      What is and where should be defined the screen element that the function uses assigning to it the Screen.Landscape property ?

      Enrico Miglino (aka Alicemirror)
      Balearic Dynamics
      Islas Baleares, Ibiza (Spain)
      www.balearicdynamics.com

      1 Reply Last reply
      0
      • AlicemirrorA Offline
        AlicemirrorA Offline
        Alicemirror
        wrote on last edited by
        #3

        Posted the bug report "#QTCOMPONENTS-1082":https://bugreports.qt.nokia.com/browse/QTCOMPONENTS-1082. Now wait that it find an answer.

        Enrico Miglino (aka Alicemirror)
        Balearic Dynamics
        Islas Baleares, Ibiza (Spain)
        www.balearicdynamics.com

        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