Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78962

setClipRect misbehavior for hi-dpi scaling with QRect overload vs. QRectF overload

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.13.1
    • Fix Version/s: None
    • Component/s: GUI: Painting
    • Labels:
      None
    • Platform/s:
      Linux/X11
    • Commits:
      19f29802bf7daafacd0fd824c2a1349e80eac536 (qt/qtbase/5.15)

      Description

      If you set some clipping (pure integer coordinates, something like 0,0,20,20) and you have some fractional scaling like via QT_SCALE_FACTOR="1.2" the clipping will cut way one pixel to many for some bad rounding cases.

      See comment

      https://bugreports.qt.io/browse/QTBUG-66036?focusedCommentId=479441&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-479441

      in

      https://bugreports.qt.io/browse/QTBUG-66036

      One can workaround by just converting the QRect into some QRectF and calling the QRectF overload instead of the QRect one.

      But that setClipRect misbehaves in such a way is neither documented nor expected.

      Screenshots with illustration of the problem in the linked comment, difference between the shots is just the QRect => QRectF conversion, integral coordinates/widths/heights.

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-78962
          # Subject Branch Project Status CR V

            Activity

              People

              • Assignee:
                vgt Eirik Aavitsland
                Reporter:
                cullmann Christoph Cullmann
              • Votes:
                3 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes