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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • None
    • 5.13.1
    • GUI: Painting
    • None
    • Linux/X11
    • 19f29802bf7daafacd0fd824c2a1349e80eac536 (qt/qtbase/5.15)

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes