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

QPainterPath::united takes seconds in some edge cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.2
    • Widgets: GraphicsView
    • None

    Description

      I am using QGraphicsView to draw some dependency diagram like things. It contains boxes and arrows between them. The arrows can be solid or dotted. The coordinates for those boxes and arrows can grow admittedly very large (x=100k) in some cases but with transformations it doesn't matter and everything can be shown just fine. However, in some very specific cases, some of the dotted arrows take a second to generate, which is prohibitively expensive.

      The time is taken in this code line: QPainterPathStroker( pen ).createStroke( arrowLine ).united( arrowHead );

      Deleting the "united" restores performance in the milliseconds range.

      Changing the pen line style to solid also restores performance to milliseconds range.

      The most surprising influence, which does not make sense to me is the pen width. Change the pen width from 4 to 3 also restores milliseconds performance.

      I have attached a minimal reproducing example / benchmark, which shows all these observations.

      According to perf, the time is spent in QPathClipper::doClip or QPathClipper::handleCrossingEdges.

      Attachments

        1. CMakeLists.txt
          0.3 kB
          Maximilian Knespel
        2. main.cpp
          3 kB
          Maximilian Knespel
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bibr Andreas Aardal Hanssen
            lqbnfiwbe Maximilian Knespel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes