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

QQuickShapes should support QPen::isCosmetic property

    XMLWordPrintable

Details

    • All
    • 3961cf124af9d811da4bbe72bb28508aef71c7df (qt/qtdeclarative/dev)

    Description

      QGraphicsView supports for the QPen::cosmetic property that allows the rendering of lines with a fixed size. This is quite useful (if not necessary) when mixing lines with scaling transformations. By default scaling applies also on lines strokes causing lines to be rendered bigger or smaller depending on the scaling factor. However there's not way to invert the scaling for the stroke. The following snippet is NOT a workaround

      ShapePath { 
          ...
          strokeWidth: 1 / Math.max(yScale, xScale) 
      }

      The previous snippet is suboptimal because the ShapePath could contain multiple PathLine instances and the strokeWidth inverted value could work well for some lines but not for others (based on the line angle). A cosmetic property on the ShapePath instead can apply a different value for each PathLine thus obtaining a better rendering of the line.

      The QQuickShapes logic seems to be somehow shared with QGraphicsView implementation. In particular it seems that the class QTriangulatingStroker support the isCosmetic property (see here)

      Attachments

        1. main.qml
          0.8 kB
          Filippo Cucchetto
        2. Screenshot_20190315_165104.png
          32 kB
          Filippo Cucchetto
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paangele Paolo Angelelli
            cuke Filippo Cucchetto
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes