Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QML; Screen return nothing
Forum Updated to NodeBB v4.3 + New Features

[Solved] QML; Screen return nothing

Scheduled Pinned Locked Moved General and Desktop
qmldesktopandroid
3 Posts 2 Posters 1.3k 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.
  • M Offline
    M Offline
    Mr1Penguin
    wrote on last edited by Mr1Penguin
    #1

    Hello! I'm trying to create qml application for several screens. For that i use Screen qml object but it looks broken for me.
    This lines
    console.log(Screen);
    console.log(Screen.desktopAvailableHeight);
    console.log(Screen.desktopAvailableWidth);
    console.log(Screen.devicePixelRatio);
    console.log(Screen.height);
    console.log(Screen.name);
    console.log(Screen.orientation);
    console.log(Screen.orientationUpdateMask);
    console.log(Screen.pixelDensity);
    console.log(Screen.primaryOrientation);
    console.log(Screen.width);
    return me
    qml: QQuickScreenAttached(0x26a82c0)
    qml: 0
    qml: 0
    qml: 1
    qml: 0
    qml:
    qml: 0
    qml: 0
    qml: 0
    qml: 0
    qml: 0
    on desktop and android devices.
    There are any ways for me help you to help me?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      synasius
      wrote on last edited by synasius
      #2

      Hi
      Are you accessing Screen inside an Item or Window type? If not, that may be the problem.
      The following sample works:

      ApplicationWindow {
           id: window    
           visible: true
           width: 480; height: 800
      
           Component.onCompleted: {
                console.debug("Screen density", Screen.pixelDensity);
           }
      }
      
      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mr1Penguin
        wrote on last edited by
        #3

        Thanks a lot! I put it in AppWindow object and it works.

        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