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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.13.1
    • GUI: Painting
    • None
    • Linux/X11
    • 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vgt Eirik Aavitsland
              cullmann Christoph Cullmann
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes