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

Qt Quick Shapes: Support subtraction

    XMLWordPrintable

Details

    Description

      Shape is documented to use QPainterPath internally (https://doc.qt.io/qt-6/qml-qtquick-shapes-shape.html), and QPainterPath supports subtraction operations (https://doc.qt.io/qt-6/qpainterpath.html#subtracted)

      However, it is currently not possible to perform subtraction on Shape/ShapePath objects, or to pass a custom C++ subtracted QPainterPath to a Shape. It would be useful to support one or both of these.

       

      Workaround
      Qt 6.8 introduced a new (private) method, QQuickPath::setPath(const QPainterPath &path) (https://codereview.qt-project.org/c/qt/qtdeclarative/+/576288 ). So, we can currently use private API to pass a QPainterPath from C++ (see attached example, which works with Qt 6.8.0-beta3)

      Attachments

        1. CppShapePath.zip
          2 kB
          Sze Howe Koh

        Issue Links

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

          Activity

            People

              qt.team.graphics.and.multimedia Qt Graphics Team
              skoh-qt Sze Howe Koh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes