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
QtWS25 Last Chance

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
  • 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 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
    0
    • B bdg85

      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 last edited by
      #2

      Anyone?

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

      mrjjM 1 Reply Last reply
      0
      • B bdg85

        Anyone?

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

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on 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 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.

          mrjjM 1 Reply Last reply
          0
          • B bdg85

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

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

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

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

            Good luck

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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

              mrjjM 1 Reply Last reply
              0
              • SGaistS SGaist

                @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)

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on 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
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 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

                  mrjjM 1 Reply Last reply
                  0
                  • SGaistS SGaist

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

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 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

                      mrjjM 1 Reply Last reply
                      0
                      • SGaistS SGaist

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

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 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
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 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
                          • mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 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
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 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

                              • Login

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