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. Get not scaled paint device on QWidget::paintEvent (ignoring devicePixelRatio)
Forum Updated to NodeBB v4.3 + New Features

Get not scaled paint device on QWidget::paintEvent (ignoring devicePixelRatio)

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 743 Views 2 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
    MSerhiy
    wrote on last edited by
    #1

    Environment: OS Windows 10, 4K display, Scale and layout set to 200% (important)

    In qt5 on QWidget::paintEvent I have a paint device with full resolution of my screen and devicePixelRatio set to 1.0, logicalDpiX returns 192, I do my own drawing there with my required zoom and I use some aligning to physical resolution so my drawing is not blurry.

    In qt6 on QWidget::paintEvent I have a paint device with twice reduced resolution of my screen and devicePixelRatio is 2.0,, logicalDpiX returns 96, so I cannot draw hi-res image because of poor resolution.

    The question is, how to make Qt6 behave like it was before (full resolution and logicalDpiX equal to 192, independent from scale)?

    I just want full resolution device for drawing, so I can port my current solution and utilize all the pixels of display.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you already went through the Hi DPI chapter and the linked part about drawing images at high resolution ?

      It looks like the effect you describe.

      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
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Did you already went through the Hi DPI chapter and the linked part about drawing images at high resolution ?

        It looks like the effect you describe.

        M Offline
        M Offline
        MSerhiy
        wrote on last edited by MSerhiy
        #3

        @SGaist
        Thank you for the warm welcome)))

        Yes, I’ve read that part, unfortunately it doesn’t change anything for me.
        In qt6 resolution and logical dpi twice less then it is in real world, and it makes me some problems.
        The size of drawing area is smaller, so I cannot just set transformation, as the size of device remains the same.
        I need somehow forbid dpi scaling.

        I just need to forbid any scaling or transformation for device made by new Qt behavior, as it was in Qt5.

        Another workaround is drawing to pixmap separately, but is it possible to set dpi to paint device? My code rely on it, and I haven’t found any function for setting dpi manually.

        T 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you already saw the Scalability part ?

          QPainter uses the devicePixelRatio of the target.

          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 MSerhiy

            @SGaist
            Thank you for the warm welcome)))

            Yes, I’ve read that part, unfortunately it doesn’t change anything for me.
            In qt6 resolution and logical dpi twice less then it is in real world, and it makes me some problems.
            The size of drawing area is smaller, so I cannot just set transformation, as the size of device remains the same.
            I need somehow forbid dpi scaling.

            I just need to forbid any scaling or transformation for device made by new Qt behavior, as it was in Qt5.

            Another workaround is drawing to pixmap separately, but is it possible to set dpi to paint device? My code rely on it, and I haven’t found any function for setting dpi manually.

            T Offline
            T Offline
            Taliadon
            wrote on last edited by
            #5
            This post is deleted!
            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