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

QGraphicsItem with setDashPattern gets drawn relative to QGraphicsView rather than the item position, when not totally on screen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.1
    • None
    • Running this on Linux/X11

    Description

      When adding in QGraphicsItems like QGraphicsLineItem to a QGraphicsScene, and setting its pen to a pen with setDashPattern results in weird behavior while scrolling the scene.

      For example, in a scene containing horizontal QGraphicsLineItem objects, when scrolling horizontally, if the lefthand side of the QGraphicsLineItem is off the edge of the QGraphicsView's viewable area (so, scrolled off the left-hand side of the screen), the dash pattern gets drawn relative to the screen, rather than to the actual geometry of the line.  In practice, what happens while scrolling is that the scene scrolls normally while the line is totally onscreen, but once the lefthand side goes past the edge, the line appears to "freeze" in place because the dash doesn't move along with the scroll anymore.

      I'm attaching a short little PyQt script which demonstrates this issue.

      Note that the script hooks into the scrollbar's valueChanged signal to call QGraphicsView.viewport().update() - without this fix, the bug described at QTBUG-63322 occurs instead, wherein the dashed line doesn't exhibit THIS problem but instead gets all corrupted when the new bits are drawn.

      Attachments

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

        Activity

          People

            iamsergio Sergio Martins
            apocalyptech CJ Kucera
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes