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

QGraphicsView::mapFromScene() rounds coordinates, causing items at the edge to disappear on scaled displays

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.8.2
    • Widgets: GraphicsView
    • None
    • - Qt Version: 6.8.2
      - OS: [Windows/macOS/Linux]
      - High-DPI Scaling: Yes
      - Screen Resolution: 4K, 200% scaling
    • macOS

    Description

      QGraphicsView::mapFromScene() returns a QPolygon, which implicitly rounds coordinates to integers.  
      This causes visual artifacts where items near the edge of the view may be clipped or disappear,  especially on high-DPI displays where a single logical pixel may map to multiple physical pixels.

      Steps to reproduce:
      1. Create a QGraphicsView and QGraphicsScene.
      2. Add an item (e.g., QGraphicsRectItem) at the scene's edge.
      3. Scale the view (e.g., view->scale(1.1, 1.1) or view->scale(1/1.1, 1/1.1)).
      4. Use mapFromScene() to get the mapped polygon and observe that its bounding rect may shift due to integer rounding.

      Expected behavior:

      • mapFromScene() should return a QPolygonF instead of QPolygon, preserving fractional values.  
      • This would prevent unintended clipping issues.

      Attachments

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

        Activity

          People

            bibr Andreas Aardal Hanssen
            kevinhoang Kevin Hoang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes