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

QPen::setStyle with Qt::DashLine corrupts rendering colors

    XMLWordPrintable

    Details

    • Commits:
      de3b2541de380c04008cce7937076e10496cb78b (qt/qtbase/dev) 5d9e7e7305fc0cbed8f7be80fb996f3ac653ff75 (qt/qtbase/5.15)

      Description

      Calling:

      pen->setStyle( Qt::DashLine );

      inside a QGLWidget's paint function can cause sudden pen color changes when drawing other things such as rects or QPainterPath's and simple lines. The pen color seems to change to colors of other objects that are drawn, but only sometimes.

      As soon as drawing only solid lines, no problems. Also the software renderer handles things fine and doesn't show this problem.

      Even in the next frames, items that are painted BEFORE the actual setStyle call will get a wrong color, even while we directly do a setPen and setBrush before painting. It is internally overwritten by Qt somehow.

      I know this might be vague, but the setStyle function, and probably setDashOffset do something that might overwrite memory somewhere or so. It is only at some times that the color changes, depending on what else is drawn on the screen.

      The problem is this happens in quite a big codebase. I am not sure if it is easy to reproduce in a small example, but it is certainly a Qt bug.

      Everything renders fine, until I start drawing some lines with the dashed pattern. Other non-solid styles also show the same issue. Only solid style's prevent this bug from happening.

        Attachments

        1. DashBug.rar
          4 kB
        2. DashBugExecutable.rar
          12 kB
        3. qtbug35513.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.graphics.and.multimedia Qt Graphics Team
            Reporter:
            buckshag John van der Burg
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes