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. QtQuick wrong Device Pixel Ratio (DPR) when using multiple screens with different DPR
Forum Update on Tuesday, May 27th 2025

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

Scheduled Pinned Locked Moved General and Desktop
screen device p
14 Posts 3 Posters 2.8k Views 3 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 13 Jul 2015, 10:30 last edited by bdg85
    #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 monitor is changed. This prevents me to update my OpenGL renderer with the new 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
           }
        }
    }
    

    B 1 Reply Last reply 15 Jul 2015, 13:12
    0
    • B bdg85
      13 Jul 2015, 10:30

      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 monitor is changed. This prevents me to update my OpenGL renderer with the new 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
             }
          }
      }
      

      B Offline
      B Offline
      bdg85
      wrote on 15 Jul 2015, 13:12 last edited by
      #2

      Anyone?

      Just ask if the question was unclear: I may add further details.

      M 1 Reply Last reply 15 Jul 2015, 22:56
      0
      • B bdg85
        15 Jul 2015, 13:12

        Anyone?

        Just ask if the question was unclear: I may add further details.

        M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 15 Jul 2015, 22:56 last edited by
        #3

        @bdg85

        Your question is very clear. ( and i dont even know quick)

        Im just wondering if you would have better luck in the QT Quick group
        as what I have seen here is mostly c++

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bdg85
          wrote on 20 Jul 2015, 06:29 last edited by
          #4

          Thank you for the advice!
          I'll post there straight away.

          Feel free to remove this one for cross-posting issues.

          M 1 Reply Last reply 20 Jul 2015, 09:41
          0
          • B bdg85
            20 Jul 2015, 06:29

            Thank you for the advice!
            I'll post there straight away.

            Feel free to remove this one for cross-posting issues.

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 20 Jul 2015, 09:41 last edited by
            #5

            @bdg85
            Well unlike other forums
            cross-posting is not really frown upon here :)

            Good luck

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 20 Jul 2015, 21:40 last edited by
              #6

              @mrjj well… It depends ;) Asking to move the post to a better suited sub-forum is the usual thing to do

              @bdg85 Did you check the bug report system ? IIRC, there was something about that (but I can't be 100% positive)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              M 1 Reply Last reply 20 Jul 2015, 21:50
              0
              • S SGaist
                20 Jul 2015, 21:40

                @mrjj well… It depends ;) Asking to move the post to a better suited sub-forum is the usual thing to do

                @bdg85 Did you check the bug report system ? IIRC, there was something about that (but I can't be 100% positive)

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 20 Jul 2015, 21:50 last edited by
                #7

                @SGaist Oh - my bad- ok, And my move, you mean delete and post again. I assume.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 20 Jul 2015, 21:53 last edited by
                  #8

                  No no, you can ask an moderator or admin to do that

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  M 1 Reply Last reply 20 Jul 2015, 22:05
                  0
                  • S SGaist
                    20 Jul 2015, 21:53

                    No no, you can ask an moderator or admin to do that

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 20 Jul 2015, 22:05 last edited by
                    #9

                    @SGaist Aha, and you are a moderator or how would i spot one?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 20 Jul 2015, 22:38 last edited by
                      #10

                      I looks like currently there's no easy way like a badge for that, would be nice though. Yes I am

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      M 1 Reply Last reply 20 Jul 2015, 22:41
                      0
                      • S SGaist
                        20 Jul 2015, 22:38

                        I looks like currently there's no easy way like a badge for that, would be nice though. Yes I am

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 20 Jul 2015, 22:41 last edited by
                        #11

                        @SGaist
                        Oh ok, so the flag icon is not for that. ? So say i had a post that needed moving. Would I then message you or post a "please move" or how would one go about it ? Maybe this not the right place to ask. just wondering.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 20 Jul 2015, 22:45 last edited by
                          #12

                          The flag is to tell moderator that there might be something fishy with a post/thread like content unrelated to Qt, spam etc. and they should look at it.

                          To move a thread, you would start a chat with a moderator to ask to move your thread when you see it's not in the right section.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 20 Jul 2015, 22:52 last edited by
                            #13

                            Is there any way to see from profile if they are a mod/admin ?
                            thank you for the clarification.

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 20 Jul 2015, 22:58 last edited by
                              #14

                              Currently it doesn't seem so

                              You're welcome

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0

                              1/14

                              13 Jul 2015, 10:30

                              • Login

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