aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickshapes
Commit message (Collapse)AuthorAgeFilesLines
* Remove hideLine flag from QQuickEllipseShapeAlexey Zerkin13 days3-24/+10
| | | | | | | | | After migration from QML version hideLine flag became useless in EllipseShape Task-number: QTBUG-142557 Pick-to: 6.11 Change-Id: I95b6407908385e4a406a15d3f36d5049e2725314 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Avoid the Shapes gradient texture cache growing without boundsEirik Aavitsland14 days1-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Nothing was ever removed from the cache, so in case of e.g. an animated gradient, a large number of texture objects would be created and not released, and memory would quickly fill up. Fix by changing the caching implementation with a set maximum number of cached gradient textures. This introduces a soft limit on the supported number of simultaneously displayed different gradients in the application. If exceeded, some objects will show wrong gradient colors. Although unlikely to be reached, the limit is documented and configurable by environment variable. As a driveby, improve the gradient cache key qHash() implementation a bit, presumably giving better spread for the QCache. Fixes: QTBUG-142208 Fixes: QTBUG-136553 Pick-to: 6.11 6.10 6.8 6.5 Change-Id: Ie104f27031572e1c392c0a8ef79d09f4a2ba5a8e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* quickshapes: Fix Unity buildFriedemann Kleint14 days1-0/+2
| | | | | | | | | | | Amends a783420505f1b68f2b8a4333d516bfa51bfb2a47. Task-number: QTBUG-141530 Task-number: QTBUG-115140 Pick-to: 6.11 Change-Id: Iab7c6bf19e1180b9a146ceb6d0b25b5234613ca9 Reviewed-by: Alexey Zerkin <alexey.zerkin@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Update default values for {Ellipse,Star,Rectangle,RegularPolygon}ShapeAlexey Zerkin2025-12-064-10/+13
| | | | | | | | | Set the same width, height, fillColor, strokeColor and strokeWidth values for rectangle, star, ellipse and regular polygon shapes Task-number: QTBUG-142450 Change-Id: I1920d22e80944ee4f220b927b4c1fcbbe2bb077a Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
* Add RegularPolygonShape to QtQuick.ShapesAlexey Zerkin2025-12-044-0/+674
| | | | | | | | [ChangeLog][QtQuick.Shapes.DesignHelpers] Added RegularPolygonShape Fixes: QTBUG-141530 Change-Id: Ifc1b9d54cb89f90d8032e44e269e6207c4e2d87f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add StarShape to QtQuick.ShapesAlexey Zerkin2025-12-044-0/+680
| | | | | | | | [ChangeLog][QtQuick.Shapes.DesignHelpers] Added StarShape. Fixes: QTBUG-141531 Change-Id: Ifcce36d3bbac7f59612c3d056e8bcbbcea034137 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickRectangleShape doesn't update on size changesAlexey Zerkin2025-12-032-4/+13
| | | | | | | | | | Update rectangle's shape whenever size has changed Task-number: QTBUG-142203 Pick-to: 6.10 Change-Id: I4495c0ffb90b781329c0e3f322b9a141d3c04bd6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Doc: Mark internal APIs with \internal commandJerome Pasion2025-11-071-0/+6
| | | | | | | | | | | These internal APIs have function documentation but are missing class documentation. Adding an internal class documentation fixes QDoc warnings. Task-number: QTBUG-141697 Change-Id: Iecb289d39e34ddaa964fbe0a1404830cd2269caa Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Resolve documentation build warningsAlexei Cazacov2025-10-032-2/+2
| | | | | | Pick-to: 6.10 Change-Id: I3b0fb5f4f734d3b2a3315479655f6434e8d85b16 Reviewed-by: Jerome Pasion <jerome.pasion@qt.io>
* QuickShapes: Make the module publicJan Grulich2025-09-261-5/+7
| | | | | | | | | | | | | The QuickShapes module was previously built as an internal-only module. This created an improper dependency for modules like QtLocation, which link against it and were consequently forced to depend on private API. This allows other modules to have a clean, public dependency on the QuickShapes API. Change-Id: I029e670f61efd29459a3bb51579cd1f796c7f0fd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add EllipseShape to QtQuick.ShapesAlexey Zerkin2025-09-175-0/+1318
| | | | | | | | | [ChangeLog][QtQuick.Shapes.DesignHelpers] Added EllipseShape. Fixes: QDS-14729 Fixes: QDS-15302 Change-Id: I0df4d6da0eb3a7cab210210fa3c695f0fe29a412 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add license headers to new shaders; stop doc bot complainingShawn Rutledge2025-09-121-2/+2
| | | | | Change-Id: I36862f842ece2432733036da18f2ab1cd663a4e9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add ShapePath.cosmeticStrokeShawn Rutledge2025-09-1210-53/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSvgRenderer already obeys the QPen::isCosmetic() setting. Now we add a ShapePath.cosmeticStroke property and try to support cosmetic stroking both with SVG and with Shapes, in all renderers. The curve renderer now starts with skinny triangles: each segment's end vertices are passed to the vertex shader with their original positions, and the shader uses the normal and the stroke width to expand the stroke triangles outwards as needed. We always add triangles for end caps, regardless whether they are square or round. We get rid of addBevelTriangle and fix bevels, square caps and miters: All three of these cases are done by drawing lines adjusted to the right direction within the respective triangles. And to avoid seeing rounded ends at any reasonable zoom level, we need the line equation coefficients to take the line very far outside the actual triangles. Square caps are really square: we render line segments in those three triangles, not extensions of the adjacent curve or line. Miters are also rendered as straight tangent lines. The bevel's triangle is very short when the join is an acute angle, and almost as tall as the full stroke width when the join is very obtuse. But when the triangle is short, we need to diminish the stroke width rendered in the fragment shader so that the center of the stroke falls on the inner corner of that triangle, and the edge of the stroke is rendered along the outer bevel edge rather than trying to go outside. That's achieved by multiplying the stroke width by the cosine of half the total angle, AKA the dot product. That is now in the normalExt.z vertex attribute. Normals (normalExt.xy) can be premultiplied rather than normalized: in fact some of them already have length > 1. In qsgbatchrenderer, Renderer::prepareAlphaBatches() breaks batches when overlaps occur. Now that we stroke lines with vertices that represent them as zero-width lines (and thus Element.bounds has the same x or y coordinates on both corners), we must consider lines right on top of each other to be overlapping: e.g. the stacks of horizontal (dashed) line segments in paint-stroke-202-t.svg must be in separate batches. At the time QQuickShape::updatePaintNode() is called, the available transform node (from UpdatePaintNodeData or an individual node's parent which is a transform node) does not contain the scaling factor that we need to allow for the stroke width to be adjusted for cosmetic stroking. But in QQuickShapePrivate::sync(), windowToItemTransform() is known, and from bde55ad574ac84440e2cdc9c1122a344bb1cb67a we have a precedent in QSGCurveStrokeMaterialShader::updateUniformData() for using the square root of the matrix determinant as a scaling approximation (ok when the scaling is uniform). QQuickShapeSoftwareRenderer::setNode() was already adjusting a path's bounding rect by its stroke width, and we need a multiplicative factor there to account for cosmetic stroking, to avoid excessive clipping in the software renderer. So now we have another use for the triangulationScale that was introduced in bcfcaeb87be783d8c329b0bc96323f1c9863982d. When QQShapeGenericRenderer is used (rendererType == GeometryRenderer), and any ShapePath has cosmeticStroke, we need it to re-triangulate whenever scale changes. QQuickShapeGenericRenderer::triangulateStroke() calls QTriangulatingStroker::setInvScale(1 / triangulationScale), and QTriangulatingStroker::process() multiplies its m_width by the inverse scale that was set (since 2009). So this tells us that the intended meaning of triangulationScale is the inverse of the factor by which we multiply the pen width. And when QQShapeGenericRenderer is in use, and there are cosmetic strokes, QQuickShape::itemChange triggers re-triangulation on changes in scale. When setting the QQuickShapeCurveRenderer::DebugWireframe debug visualization flag, we need to repeat the vertex shader calculations to expand the "skinny" triangles according to stroke width, just as we do with the actual stroking vertices. For now customTriangulator2 remains as legacy code, to be removed later on. It's poorly named, and returns a list of TriangleData which need to be iterated afterwards ("fix it in post"), looking up the QQuadPath::Element again in that second loop, which can go wrong when a path contains a move command. (For example, it could calculate a bevel between the end-tangent of one subpath and the start-tangent of the next.) customTriangulator2() was called from only one place, processStroke(), to which addStrokeTriangleCallback() is given: so the new way is to just call the callback directly as soon as we've calculated each triangle. Because we are not iterating again afterwards, the switch(type) is not needed in that case, and we no longer need TriangleData::type, except for supporting customTriangulator2(). [ChangeLog][QtQuick][Shapes] ShapePath now has a cosmeticStroke property which causes strokeWidth to be constant despite scaling. Set the environment variable QT_QUICKSHAPES_STROKE_EXPANDING to 1 to enable an experimental method of expanding strokes in the vertex shader, minimizing the need to re-triangulate when strokeWidth changes. Task-number: QTBUG-124638 Change-Id: I4eac0ddcd6f623b79bc70c766ff116f4b77736cb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Cleanup, refactoring and internal docs in curve processor and rendererShawn Rutledge2025-09-101-14/+20
| | | | | | | | | | | | | | | | | | | - calculateJoin() is too big to continue as an internal lambda, and changes to customTriangulator2 (the only user) are coming later; so move it out to a top-level static function - use const - capture simple constants in the tooLong lambda - explicit captures in remaining lambdas - replace some single-letter variables with more meaningful ones - turn some plain comments into internal function docs - a couple of spelling and grammar corrections - init TriangleData::pathElementIndex=INT_MIN by default, to be able to distinguish default-constructed instances. Of course they are usually >= 0, but customTriangulator2() uses small negative indices as special triangle-type indicators. Change-Id: I7b70a02ac56522ee0c6aff26be80ac4e3e546bbd Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Curve renderer: Handle multiple syncs before updateNodeEirik Aavitsland2025-07-301-4/+12
| | | | | | | | | | | | | The renderer may receive multiple beginSync/endSync calls, with new path changes inbetween, before updateNode() is performed to commit the new node data. For a shape in the default non-asynchronous mode, the later sync rounds would not be handled in a timely fashion in such cases. Fixes: QTBUG-133267 Pick-to: 6.10 6.9 6.8 Change-Id: I65345b50755a2528663a28de3599be0b256a4790 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge BorderShape API into RectangleShapeMitch Curtis2025-07-223-105/+851
| | | | | | | | | This takes the code that was originally going to be BorderShape and merges it into RectangleShape. Fixes: QDS-15299 Change-Id: I8c1133ee5d916b46ba37b852a069b2034eee5a03 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* CurveRenderer: Don't spend time populating unused listEskil Abrahamsen Blomfeldt2025-06-241-6/+8
| | | | | | | | | | | When the debug wireframe is disabled, we would still populate the wireframe vertices, even though these are never read. This shows up as a small hotspot in valgrind and skipping it gives a small performance improvement. Pick-to: 6.10 Change-Id: I51ef403f088154a99c7335356655d3f2cc17b4de Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add trimming functionality to ShapePathEirik Aavitsland2025-03-249-24/+154
| | | | | | | | | | Allows specifying a subsection of the defined path to be displayed. This mirrors the recently added trimmed() method of QPainterPath. [ChangeLog][QtQuick][Shapes] Add path trimming functionality Change-Id: I76371832df07cbab9d81a557b25a6fd53150630e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add RectangleShape to QtQuick.Shapes.DesignHelpersMitch Curtis2025-03-0413-75/+953
| | | | | | | | | [ChangeLog] Added new QtQuick.Shapes.DesignHelpers module. [ChangeLog][QtQuick.Shapes.DesignHelpers] Added RectangleShape. Fixes: QDS-13283 Change-Id: I736e4062d5b618495cce336edb77f7b7915b7d62 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QuickShapes: Handle removals of ShapePaths correctlyEirik Aavitsland2025-01-314-1/+26
| | | | | | | | | | | | | | | | | | | Removing paths other than the last could put the the renderers out of sync, since the path items would change their place in the list. Fix by ensuring that all items added to the list are marked as dirty. This works since removals are implemented as list clearing followed by adding back the unremoved items. In addition, the curve renderer did not remove the scene graph nodes when the path list shrinks. Same for the geometry renderer when the list shrinks to empty. So removed paths would still be visible. Fix by implementing handling of these cases. Fixes: QTBUG-133230 Fixes: QTBUG-133231 Pick-to: 6.9 6.8 Change-Id: Ie871e480b99c6b22be9efbceb1e3a4f828f868e7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QSGCurveProcessor: Replace bool isLine with TriangleFlagsShawn Rutledge2024-12-051-3/+3
| | | | | | | | We will soon need more flags to deal with cosmetic stroking. Passing a bool was predictably limiting. Change-Id: I3f1a2e27b4cb75fd3b974e4f24604c5284809251 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* doc: Add note about assigning items directly to fillItemEskil Abrahamsen Blomfeldt2024-11-211-0/+16
| | | | | | | | | | | | | | | | Using items with no visual parent as sources causes error messages and empty contents, both for shader effects and as fill items. This is a particularly easy mistake to make with shapes, since the fact that ShapePath is not a QQuickItem is not obvious. At the least we should mention this case in the documentation and provide a solution for it. Pick-to: 6.8 Task-number: QTBUG-130893 Change-Id: Ibeed382a8fa35cf69e8d5a4b61b04dc5e77df217 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Curve renderer: Avoid keeping unneeded QuadPath objectEirik Aavitsland2024-10-142-25/+19
| | | | | | | | | | | | | | The pathData structure would keep a copy of the QuadPath used to generate the stroke nodes. That copy was never used for anything, so remove it. This commit also cleans up the functions to generate stroke nodes, by decoupling them from the internal PathData structure. This was earlier done for the corresponding addFillNodes() function. Pick-to: 6.8 Change-Id: I414b421dfc0cdf5c38e52a298476433f7643b5db Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Curve renderer: Avoid losing updates during async processingEirik Aavitsland2024-09-272-29/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | If a new sync round, updating path properties, happened while an async thread was already processing a previous update, it would not trigger a new round of processing and node update. This would usually not be noticed, since another sync and update would typically happen shortly after, say during an animation, and the changes would be picked up then. However, updates from singular or stopping animations could be "lost", in the sense that the node (and thus rendering) was not brought in sync with the updated path properties in a timely fashion. Fix by kicking off new async processing and update right away when detecting that path properties have changed while the previous processing was running. This also fixes a related minor issue: at node update time, uniforms where set from the current state, instead of the state as it was when the path processing started. In the async case, that may be different, so it was possible for the node properties to be briefly set to an inconsistent state. Fixes: QTBUG-128637 Pick-to: 6.8 Change-Id: I44de44c796e8bd7c2f84e80cac0811951b9a2bd4 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Curve renderer: Fix crash when root node is replacedEirik Aavitsland2024-09-042-0/+10
| | | | | | | | | | | | | | | | | | A curve renderer instance keeps references to the fill and stroke nodes it has created, in order to facilitate maintaining correct rendering order when updating. All nodes are children of the renderer's root node. It can happen, like when hiding and re-showing a Popup, that the renderer instance is assigned a new root node. The references to the child nodes are then invalid, and accessing them will fail. Fix by clearing all such references when a new root node is set. Fixes: QTBUG-128561 Pick-to: 6.8 6.7 Change-Id: Ibc4992780867049e9e38a2bf1a163eed79bdc5c0 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Doc: Replace \instantiates with \nativetypePaul Wicking2024-08-201-6/+6
| | | | | | | | | | | Since the implementation of the `\nativetype`-command in QDoc, the `\instantiates`-command is deprecated. Replace the use of the deprecated command in favor of its replacement. Pick-to: 6.8 Task-number: QTBUG-128216 Change-Id: I23d9f66d3f6db2e5f827d7868497a432bb9b0626 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Curve renderer: cleanup and optimize fill node computationEirik Aavitsland2024-08-161-35/+42
| | | | | | | | | | The curve renderer allocated and computed vertices for wireframe debugging visualization also in the typical case of that not being enabled. Pick-to: 6.8 Change-Id: Ic5fb724983fa8db985fcf6a075523bd9a4cee361 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Curve renderer: fix crash in wireframe debug visualizationEirik Aavitsland2024-08-081-0/+3
| | | | | | | | | | | | | Earlier, the uniform updating in updateNode() would access the fill nodes only as QSGCurveAbstractNode, since it only called setColor(). Recent changes have added muany more uniform settings (texture fill, gradients etc), and hence the nodes are now being accessed as QSGCurveFillNode. That will crash for the wireframe debug nodes. Add a flag to filter out those nodes. Pick-to: 6.8 Change-Id: Id167d0d85d8800110a44cc5eac9eb0dbec8bf03b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Avoid leaking nodes in when curve renderer is destroyedEirik Aavitsland2024-08-082-3/+18
| | | | | | | | | | | | | | | | For each visual change, the curve renderer generates new scene graph nodes in runner objects. If the renderer was destroyed before the item was updated, the runners and their nodes would be leaked (always in sync mode, and sometimes in async mode). Fix by making the renderer clean up the runners on exit, and the runners clean up any nodes that have not been inserted into the scene graph. Fixes: QTBUG-127519 Pick-to: 6.8 Change-Id: I9fcfe9d0b67cfa5b4c6fcef59cc5f78c579ec7ea Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Doc: Fix linking issuesTopi Reinio2024-07-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Fixes the following warnings: (qdoc) warning: Can't link to 'qquickattachedpropertypropagator.html' (qdoc) warning: Can't link to 'Type Of Parameter In Signal Cannot Be Used' (qdoc) warning: Can't link to 'QQmlEngine Class#QML_ELEMENT' (qdoc) warning: Can't link to 'qml-qtqml-component.html' (qdoc) warning: Can't link to 'import paths' (qdoc) warning: Can't link to 'qml-var.html' (qdoc) warning: Can't link to 'Qt Quick Shapes' (qdoc) warning: Can't link to 'Qt Svg' (qdoc) warning: Can't link to 'Native Menus' (qdoc) warning: Can't link to 'Popup Items' (qdoc) warning: Can't link to 'Popup Windows' (qdoc) warning: Can't link to 'Grid QML Type' (qdoc) warning: Can't link to 'layer.smooth' Pick-to: 6.8 Change-Id: Ia61b0568f481018850027f445446f64122abb5fd Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Shape: Add Q_DECLARE_OPERATORS_FOR_FLAGS for PathHintsKaj Grönholm2024-07-161-0/+2
| | | | | | | | | This allows using PathHints properly also from C++. Task-number: QTBUG-127121 Pick-to: 6.8 Change-Id: I64800c7bbc02a38795fca9e224a228fcb893fe79 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Tweak curve renderer codeKaj Grönholm2024-07-152-7/+3
| | | | | | | | | Minor code improvements, mostly removing unnecessary code. Task-number: QTBUG-127121 Pick-to: 6.8 Change-Id: I57732969c06c441c3e1296dc7618e50f279e5bd1 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QuickShapes: Unify the renderers' handling of 0 strokeWidthEirik Aavitsland2024-07-122-5/+5
| | | | | | | | | | | | | | | A stroke of zero width should not be visible: that seems to be the intuitively expected behavior, and corresponds to what SVG does. However, in Qt Quick shapes, only the curve renderer backend behaved like that. The geometry and software renderers would behave differently, and different to each other. This commit standardizes on the SVG behavior. Fixes: QTBUG-126819 Pick-to: 6.8 Change-Id: I63410a732066facfad0a5f6e0565e2e80becb397 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
* Add QPainterPath API to all quick shape renderersMatthias Rauter2024-07-116-3/+16
| | | | | | | | | | CurveRenderer can render a QPainterPath directly, while its sister classes require a QQuickPainterPath. This patch adds the same API to the generic shape renderer and the software renderer. Pick-to: 6.8 Change-Id: Ib0b4a6739d21f7d27c38df2d93f2394be23eced8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use best practices in the Quick Shapes exampleEirik Aavitsland2024-07-031-3/+14
| | | | | | | | | | | | | | | | Circles and ellipses can now be expressed simpler with a single PathAngleArc object, instead of two PathArcs. Similarly, use PathRectangle instead of four PathLines. Also fixes various minor qml issues flagged by qmllint. As a drive-by, improves the doc of the new fillTransform property with example code that matches one of the gallery examples. Pick-to: 6.8 Change-Id: I4529cca08c0cffc51d495f8ce815b50c053e4aa3 Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Shapes: Straighten out some logging categoriesUlf Hermann2024-06-141-1/+1
| | | | | | | | | | | Either make them static or declare them in a header. We want them to be static wherever possible, in order to reduce the number of visible symbols. If they can't be static, however, they should at least be declared in only one place. Task-number: QTBUG-67692 Change-Id: Id754da0f3a63dc27984253a03be9b4acaf92f2b1 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove the use of GENERATE_CPP_EXPORTS argumentAlexey Edelev2024-06-111-1/+0
| | | | | | | | | The behavior that argument was enabling is the default one now. Pick-to: 6.8 Task-number: QTBUG-90492 Change-Id: I11711d4c794f0b22169abb595b8ffad2eeb1300d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Curve renderer: avoid unnecessary re-triangulationEirik Aavitsland2024-05-312-36/+27
| | | | | | | | | | | Changes in gradient and filltransform only require the uniform block to be updated. Clean up and improve the uniform updating in the pathdata and fill nodes, avoiding redundant recomputations and reallocations. Fixes: QTBUG-125403 Change-Id: I3cf3e8524e9386618cb8cc34a1097e27454da527 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Don't update transform if it hasn't changedEskil Abrahamsen Blomfeldt2024-05-301-1/+4
| | | | | | | | | | | | | | | Updating the transform marks it as dirty and causes rebatching. Since we were doing this even when nothing had changed, we were essentially rebatching every time there was any update to the shape. We should leave it to the node to decide if it has been updated. This adds two tests that verify that rebatching still happens when changing the color/gradient of the shape. Pick-to: 6.7 Change-Id: Iefb7a21a89ac2c31053e473cf689fa06e34a40d5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Texture fill for shapesEskil Abrahamsen Blomfeldt2024-05-2712-23/+517
| | | | | | | | | | | This introduces a "fillItem" property to ShapePath. Similar to gradient, this enables filling a shape with any texture provider item, such as an image, a ShaderEffectSource or a layer-enabled item. Fixes: QTBUG-104121 Change-Id: I8748a90c825e8eb4655a4ac90648c6ae74420527 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add fillTransform property to ShapePathEirik Aavitsland2024-05-1415-23/+132
| | | | | | | This adds functionality corresponding to QBrush transform to QuickShapes. Change-Id: I2b5903f8c228adec65a6f5be64e3816143879302 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* doc: Fix mismatching enum names in property docsEskil Abrahamsen Blomfeldt2024-05-141-2/+2
| | | | | | | | These enums were renamed before the final commit, but the documentation was never updated. Change-Id: Ic736710afd9d8a4dfc51e855f3b6c7f2d153cc1a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add missing revisions for new 6.7 APIsVolker Hilsheimer2024-03-011-1/+1
| | | | | | | | Pick-to: 6.7 Task-number: QTBUG-119952 Change-Id: Id04ba05d551ffd487fd61c5a6222b33883b684e1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add optimizations and simplifications for curve renderer fillEirik Aavitsland2024-02-241-0/+3
| | | | | | | | | | | | | | | | | | | In addFillNodes(): - Pre-allocate estimated needed number of elements in temporary lists, to avoid reallocations. In processFill(): - Remove QHashes that were never read - Fewer conversions QVector2D<->QPointF (float<->double) - Add a qHash for QVector2D. Simplifies by removing need for conversion to qpair<float, float>, and is also more efficient since it hashes both elements at once. Pick-to: 6.7 Change-Id: If11c67ee198d9d29a9d290efe0e808fb7c70ee9c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add performance benchmark test for curve rendererEirik Aavitsland2024-02-242-8/+15
| | | | | | | | | | | | | Includes some minor tweaks to the curve renderer itself, to facilitate running it directly from C++, outside of the Shapes plugin in a Quick application. These include exporting the class, and adding an addPath method taking a QPainterPath directly, avoiding the need to construct a QQuickPath. Pick-to: 6.7 Change-Id: I91c66d8744af807bcff4132d054cff86d2453085 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Partially revert "Make some properties in Qt Quick Shapes FINAL"Fabian Kosmale2024-02-141-31/+31
| | | | | | | | | | | | Making properties FINAL is an API break not covered by any QUIP rule. This does not affect the properties which were only introduced with Qt 6.6. This partially reverts commit e31821795e6e44db93e5fd27a18273ba9fba1af5. Pick-to: 6.6 6.7 Change-Id: I413528c78c8f8e621fd815cafc6cc75bb6dd7216 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* doc: Add missing \since tags; wrap and indentShawn Rutledge2024-01-261-4/+8
| | | | | | | | | Amends bc65c90cce711f6ae489ea1328b104cbd4583117 and 93fd421fdac96adfc33ecca974ee21fcdfbdb7b9 Pick-to: 6.7 Change-Id: I0f65b7852ee3e5e2e04b6ccb0a1381cd879da19a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Curve renderer: Optimize overlap handlingPaul Olav Tvete2024-01-231-3/+1
| | | | | | | | | | | | | | | | Use QSGCurveProcessor::findOverlappingCandidates() to reduce the complexity from O(n^2) to O(n log n). The new code now supports the concave join case by default. This means that the QT_QUICKSHAPES_WIP_CONCAVE_JOINT environment variable no longer serves a purpose, so it is removed. Task-number: QTBUG-121215 Fixes: QTBUG-114807 Pick-to: 6.7 Change-Id: I080ef08cb5c7e581abfbb1e66d47bdd48f3019c5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use shape hints in the curve rendererPaul Olav Tvete2024-01-172-3/+9
| | | | | | | | | | We don't need to do expensive operations if we already know that the path is well behaved. Task-number: QTBUG-112340 Pick-to: 6.7 Change-Id: Ic386b7f293045c28294f56ad433bdae2b3b6b0e5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* scenegraph: Add plumbing for enabling multiviewLaszlo Agocs2024-01-1512-53/+108
| | | | | | | | | This will be used in RenderMode3D only in practice, where Qt Quick 3D is going to pass in multiple matrices to the QSGRenderer. Task-number: QTBUG-114871 Change-Id: Icae7f05958729d9e51948e1f38621ec4a541192d Reviewed-by: Andy Nichols <andy.nichols@qt.io>