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. Wrong Device Pixel Ratio (DPR) when using multiple screens with different DPR
Forum Updated to NodeBB v4.3 + New Features

Wrong Device Pixel Ratio (DPR) when using multiple screens with different DPR

Scheduled Pinned Locked Moved QML and Qt Quick
screen device d
1 Posts 1 Posters 600 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.
  • B Offline
    B Offline
    bdg85
    wrote on last edited by
    #1

    Hi,

    I have a retina mac book pro connected with a bigger screen:
    Screen1: LCD (retina, devicePixelRatio=2) 1280x800 (in device points)
    Screen2: LED Cinema Display (non retina, devicePixelRatio=1) 1920x1200

    The problem is this:
    If my QtQuick main window starts in Screen2, it detects the wrong screen (Screen1). Therefore, if I drag the window to Screen1, no signal is raised that the screen is changed. This prevents me to update my OpenGL renderer with the correct devicePixelRatio.

    I have written a simple test application in QML to show this:


    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtQuick.Window 2.2
    
    ApplicationWindow {
        id: appWin
        title: qsTr("Hello World")
        width: 440
        height: 320
        visible: true
    
        Screen.onDevicePixelRatioChanged: {
            console.log("dpr changed");
            dprSignalId.text = "dpr changed at seconds: " + new Date().getSeconds();
        }
    
        Column{
           Text{
               id: screenTextId
               text: Screen.name + " " + Screen.devicePixelRatio + " " + Screen.width + "x" + Screen.height
           }
           Text{
               id: dprSignalId
           }
        }
    }
    

    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