aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/shapes
Commit message (Collapse)AuthorAgeFilesLines
* Move Qt Quick Shapes exampleEskil Abrahamsen Blomfeldt2024-01-0630-6062/+0
| | | | | | | | | | | | | Usually, we have separate top-level example directories for different modules, but since Qt Quick Shapes only had a single example, it was categorized under examples/quick. We now plan to add more, so to prepare for that, this sets up the normal structure with an examples/quickshapes directory. Pick-to: 6.7 Change-Id: I50016358b674c18bb2930459d4e0111862ddcedb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add zooming to the shapes examplePaul Olav Tvete2023-10-036-3/+161
| | | | | | Pick-to: 6.6 Change-Id: If10ffe77b5e61f605f9f735c51f639c422844b2d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Rename shapes example qml files according to what they demonstrateShawn Rutledge2023-09-274-163/+163
| | | | | | | | | Amends 270a6f9bba75478204dc6aadb348cf34a195a4da Fixes: QTBUG-115485 Pick-to: 6.2 6.5 6.6 6.6.0 Change-Id: Id77b4dd8ce83175ebe29d24bf987572d5e9069d7 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Doc: Add example categories for qtquickJaishree Vyas2023-09-051-0/+1
| | | | | | | | Task-number: QTBUG-116334 Pick-to: 6.5 6.6 Change-Id: Id17a546b9363e5225b8778c629fe9ffe30d2e719 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Add CurveRenderer item into shape antialiasing exampleKaj Grönholm2023-08-232-1/+51
| | | | | | | | | | CurveRenderer has built-in antialiasing supports, so compare it here to MSAA and SSAA. Task-number: QTBUG-104122 Pick-to: 6.6 Change-Id: I207ab770cae052b195e9da8802dc594a91ce713b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Introduce hardware accelerated curve renderer for ShapesEskil Abrahamsen Blomfeldt2023-05-262-12/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the Loop/Blinn algorithm for quadratic curves as an optional backend for Qt Quick Shapes, basically distance fields where the distance to curves are calculated in the fragment shader. This means cubic curves are approximated, which will give varying results, but for many shapes (such as text) this is efficient and means the shapes can be zoomed indefinitely while still retaining curvature as well as anti-aliasing working without MSAA. Preliminary results give some frame rate improvements compared to doing MSAA and GeometryRenderer, but the major improvement is that you can get smooth curves at any zoom level without re-triangulating the shape. Note that the renderer currently does not do antialiasing for straight lines. This would still require MSAA, but at a lower cost than for GeometryRenderer since there are much fewer triangles. Adding AA here as well is work in progress. Task-number: QTBUG-104122 Done-with: Paul Olav Tvete <paul.tvete@qt.io> Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io> Done-with: Amr Elsayed <amr.elsayed@qt.io> Change-Id: I6b4a1103546fbdfe760906f7a183101f8eedb9d3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Examples: Use versioned CMake targets for Qt modulesKai Köhne2023-05-021-4/+4
| | | | | | | | | | | | Use e.g. Qt6::Core instead of Qt::Core. This is better matching the find_package(Qt6 ...) call, and also avoids issues that the versionless targets have. Pick-to: 6.5 Task-number: QTBUG-113277 Change-Id: Ib80f885e9f73fb9ad54b9e9b22cae2318877dc07 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Shapes example: adhere to guidelinesOliver Eftevaag2023-03-1022-317/+759
| | | | | | | | | | | | | - Fix all qmllint warnings. (except for main.qml, interactive.qml, and sampling.qml) - Translate user facing strings when it makes sense to do so. - Mark readonly properties as 'readonly'. - Avoid binding on multiple properties on a single line. (except for tiger.qml). Pick-to: 6.5 Change-Id: Idbf8a472ca5ba5385d1368aadd608e95231a07f0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Replace AUTO_RESOURCE_PREFIX with Qt CMake Policy in examples, testsAmir Masoud Abdol2023-02-211-2/+1
| | | | | | | | | | | | | | | | Every instance of AUTO_RESOURCE_PREFIX has been replaced by either qt_standard_project_setup(REQUIRES 6.5) or with qt_policy(SET QTP0001 NEW), mainly in tests. In addition, I added a warning message for the case where AUTO_RESOURCE_PREFIX is used. Pick-to: 6.5 Task-number: QTBUG-96233 Change-Id: I323a15e9d0bb5fe6ba649365314af9fc2ad67bda Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* CMake: Allow omitting the version of QML modulesUlf Hermann2023-01-271-1/+0
| | | | | | | | | | | | | | | | | Also, drop all the VERSION 1.0 lines from the examples and tests. 1.0 is actually a bad default version since it's before all the Qt versions. [ChangeLog][QML] You can now omit the VERSION argument to qt_add_qml_module(). This will automatically generate the highest possible version. Pick-to: 6.5 Task-number: QTBUG-99146 Change-Id: Ic10ec69b87c224e0e94e1785f65653815d4c778c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Quick examples: Modernize cmake files according to our guidelinesOliver Eftevaag2023-01-161-8/+5
| | | | | | | | | | | | | | | | The following changes are made to the CMakeLists.txt files in all quick examples: - Use PRIVATE linkage when possible. - Use qt_standard_project_setup() - Set WIN32 and MACOSX_BUNDLE in qt_add_executable() instead of set_target_properties() Pick-to: 6.5 Change-Id: I18217585aec56794b327f103d6959879df59d68a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-09-071-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: Id89ed14990804a5024183e75382cc539d4293da1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-081-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Adapt examples to AUTO_RESOURCE_PREFIXUlf Hermann2022-06-242-1/+2
| | | | | | | | | | | Examples that don't explicitly set NO_RESOURCE_TARGET_PATH get the AUTO_RESOURCE_PREFIX now. Task-number: QTBUG-103452 Change-Id: I6b41e96ce5620079f60ca2f967b0a2e611c1f738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-1125-1202/+50
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Improve examples CMakeLists.txtKai Köhne2022-01-241-11/+6
| | | | | | | | | | | | | | | | | | - Remove # generated from xyz.pro comment from pro2cmake - Remove "# special case" markers for pro2cmake - Remove automatic use of CMAKE_AUTORCC - Only opt into CMAKE_AUTOUIC if .ui files are involved - Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR - Combine multiple find_package(Qt6 ... calls) - use REQUIRED COMPONENTS - sort components alphabetically - Fix wrong indentations - Use (only) one empty line after multi-line commands Pick-to: 6.3 Change-Id: I0d6bfb06c4b25e9921d3d2bf31d977150f12b31b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix wrongly copy-pasted dependency in exampleAlexandru Croitor2021-10-011-1/+1
| | | | | | | | | Amends edc4357ae4893dd952ce1c07b180b4b334047606 Pick-to: 6.2 Task-number: QTBUG-96805 Change-Id: Iedbf372cd94b1b04db55685a5d05daca491200fe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Fix examples that use 'shared' project when using a static QtAlexandru Croitor2021-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using a static Qt, linking of examples that use the 'shared' Qml module would fail with the following error Undefined symbols for architecture x86_64: "qt_static_plugin_sharedPlugin()", referenced from: StaticsharedPluginPluginInstance::StaticsharedPluginPluginInstance() in window_shared_init.cpp.o This happened because the 'shared' project pre-created its plugin target with qt_add_library instead of qt_add_plugin. qt_add_plugin passes an additional QT_STATICPLUGIN compile definition when compiling the moc'ed file to ensure that the QT_MOC_EXPORT_PLUGIN macro creates a qt_plugin_instance_PLUGIN_NAME symbol. Unfortunately we can't use qt_add_plugin for shared Qt builds, because some of the projects link directly against the plugin target and it's not possible to link against a MODULE_LIBRARY target which qt_add_plugin creates in shared Qt build. We could try to conditionally switch between using qt_add_library for a shared Qt build and qt_add_plugin for a static Qt build, but that further complicates the build system code because it requires specifying a class name and plugin type explicitly. Remove the direct linkage against the libraries in the examples and instead rely on plugin loading. This simplifies the logic of not having to pre-create a target. Amends 7b6eea37aeea55cdf1bcb1fd9c3091d6753f95e8 Pick-to: 6.2 Fixes: QTBUG-96805 Change-Id: I5b2f3992ccda29b59f1e99748005381c73daca69 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Shapes interactive example: use Controls canonically; architectureShawn Rutledge2021-09-271-259/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As long as we had the funcs array, it would have been nice to be able to directly get an index from whatever "tool" is selected. For example, TabBar has currentIndex; but TabBar is otherwise not a great fit here. But the funcs array wasn't so elegant anyway. So that prompts switching to the known OO design pattern in which drawing tools are objects containing functions that "do" the drawing, so that there's no conditional dispatch: just ask the tool to handle each mouse state change. I.e. here the DragHandler on the canvas uses the tool's shapeType Component to create the shape, but the DragHandler doesn't have to care which shape it is. Handles for moving the shapes' control points are also shape-agnostic: - a handle is a sort of template taking the path x and y properties to read and write - the handle initializes its position from those properties - the DragHandler inside gets to do what it does best: just drag the handle, nothing else (instead of needing to script the movement of both the handle and the control point, we don't script either one) - declarative bindings on the handle's position update the path properties whenever the handle moves And some styling: - Switch looks better than Button for toggling - use palette colors so that it looks good in dark mode too - fix handle colors getting stuck on yellow - borders on handles (yellow on white makes it hard to see the edge otherwise) - reorder curve types by mathematical order (line, quadratic, cubic) Pick-to: 6.2 Change-Id: Iefd980f428601840deb55370aad9256748855f07 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Shapes example: give each qml file's root item a default sizeShawn Rutledge2021-09-2217-2/+32
| | | | | | | | | | | | | | | | Each square is resized anyway in shapegallery.qml; but for the sake of running individual examples on the command line with qml, the content being shown should be visible. Without this fix, each item had a 0,0 size by default; but the shapes themselves have their own sizes and are centered in the zero-size root item. But when a window is created, the window system does not allow it to have zero size, so it expands; and then the shape would be centered at the top-left corner, and you could only see part of it. Pick-to: 6.2 Change-Id: I42a537421430aea8233106353e9c2033f5bc5774 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Install the "shared" example module into macOS bundlesUlf Hermann2021-09-031-0/+1
| | | | | | | | | | | | | | | If we build an application bundle we cannot rely on the relative path between the application's and the shared module's output directories. This is somewhat ugly, but as we don't have a comprehensive solution for building application bundles, yet, it's the best we can do right now. In order for the shared bundle to be loaded from the PlugIns directory, we need to add the PlugIns directory to the import path on macOS. Pick-to: 6.2 Change-Id: I5b952420b4bb60af74886a140fa2c6a263d2f730 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Rename shapes example qml files according to what they demonstrateShawn Rutledge2021-09-0119-48/+48
| | | | | | | | | | | | The order they are shown in the grid is not important; but users should be able to run any of these qml files directly without building the example, and appropriate names make the "right one" easier to find. Task-number: QTBUG-95739 Pick-to: 6.2 Change-Id: I9751b52ce80bc08e12919ca3396c9d428d700a04 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clean up shapes exampleUlf Hermann2021-09-0126-182/+61
| | | | | | | | | | | | Drop the confusing alias mangling on all the QML files. Instead move them into the base "shapes" directory. Also, use a QML module in CMake and use the "shared" module as intended. Pick-to: 6.2 Change-Id: I6a8fc3f2b2f86f58a54e188cf83ec7e2d4e8f468 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Shapes example: use qqc2 componentsOliver Eftevaag2021-08-2825-122/+134
| | | | | | | | | Changing the example to use qt quick controls where it makes sense Task-number: QTBUG-95739 Pick-to: 6.2 Change-Id: Id0df227657693234de4481c2316dc6c3e0545043 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-171-1/+1
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I9f76b787533dad1c469fbb8c69df6c27b20a9aa3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* examples: Use template literals for multiline stringsMaximilian Goldstein2021-05-031-2/+2
| | | | | Change-Id: I660a74730edf60d0b7760162b441e3e14749e930 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use functions as signal handlers when accessing parametersUlf Hermann2021-02-121-3/+3
| | | | | | | | | Injected signal handlers are bad practice because they aren't declared. Pick-to: 6.1 Task-number: QTBUG-89943 Change-Id: I3a691f68342a199bd63034637aa7ed438e3a037b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate examples to set the WIN32_EXECUTABLE propertyAlexandru Croitor2020-10-261-0/+4
| | | | | | | | | As well as the MACOSX_BUNDLE properties as necessary. Task-number: QTBUG-87664 Task-number: QTBUG-86827 Change-Id: I46769fb543acb2cbeba122470b5e44ad478fbe4e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examples to use qt_add_executableAlexandru Croitor2020-10-201-1/+1
| | | | | | Task-number: QTBUG-87661 Change-Id: Ie5bba408000211b24694aa0143bdf79c4a298f42 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* CMake: Regenerate qtdeclarative/examplesAlexandru Croitor2020-05-291-1/+5
| | | | | | | | | Includes - new example installation paths - one case of QT_QMLTYPES_FILENAME addition Change-Id: I24423da9b04b6ecc8445017fa35f148dd43b1829 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-121-1/+1
|\ | | | | | | | | | | | | | | Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
| * Fix vertical position of PathTextEskil Abrahamsen Blomfeldt2020-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The PathText would always translate to y=0, regardless of what y was set to. We should obviously get the y coordinate of the shape *before* translating it into position to find the distance from the baseline. This change also updates the example, which had not been updated to the changed origin of the PathText, and it adds a Lancelot test for keeping track of the PathText shape rendering. Change-Id: I940ac956af5229842739f8d8751a1f13bb86b8e7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Post-merge fixesAlexandru Croitor2020-01-301-0/+4
| | | | | | | | | | Change-Id: I2350df5368ee34d6c7072d456806e518ce533839 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-01-294-1/+78
|\| | | | | | | | | | | | | Conflicts: dependencies.yaml Change-Id: Ie3e9dc62031a85e5e81cbdf04694b95159d49fca
| * Introduce PathText path elementEskil Abrahamsen Blomfeldt2020-01-214-1/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For text rendering in Qt Quick, we currently have the limitation that when rendering text at such a large size that the distance fields start showing artifacts, the only option is to use NativeRendering, which will look nice, but which will use a lot of texture memory for the glyph cache, since it will actually cache the glyphs at the requested size. A suggested approach would be to fall back to using triangulated paths when the font gets large enough, but the work on this was never completed. It turns out that we can get this now, basically for free, since we already support rendering arbitrary QPainterPaths using Qt Quick Shapes. The only thing missing is the ability to add the path of a given text to the shape. This patch fills in that gap. Note that this is currently not supported by nvidia renderer. [ChangeLog][QtQuick] Added PathText path element which can be used together with Qt Quick Shapes to get text rendering that does not cache glyphs in a texture, but triangulates the outlines of the glyphs instead. Change-Id: I436e1476b129b324cf7a54f89a1b18e0579e8185 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-141-27/+86
|\| | | | | | | | | | | | | Removed dependencies.yaml because we don't use it yet in wip/cmake. Fixed conflict in qmlcachegen.cpp. Change-Id: Ie1060c737bee1daa85779903598e5b6d5020d922
| * Examples: Avoid Qt.createQmlObject()Ulf Hermann2019-10-021-27/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | We don't want to encourage Qt.createQmlObject(). It's the equivalent of eval() in JavaScript. This has the added benefit that the shapes actually react to changes in the parameters now. Before, once a shape was drawn, it didn't get updated when you manipulated the line width or fill controls. Change-Id: I8d5b7598799b52043f86fd1f617e31de09331891 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Regenerate ExamplesLeander Beernaert2019-10-141-2/+2
| | | | | | | | | | Change-Id: I2fbfb44bbb6d667e022bffb480feaf74ff0d0a5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Update Examples with lowercase qt6_add_resources()Leander Beernaert2019-09-201-1/+1
| | | | | | | | | | | | | | | | Re-run pro2cmake on all exampls. Change-Id: Iafd1092beff023b407a8f29c2a5b651f2e534b75 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Convert ExamplesLeander Beernaert2019-08-231-0/+157
|/ | | | | | | | This patch converts all examples in qtdeclarative except for a few exceptions which require a public facing qml plugin api. Change-Id: I2cd2b1bb455be8b48796893a8235dea7f8b35aa2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Get rid of Qt.labs.handlers import, merge into QtQuick 2.12Shawn Rutledge2018-07-172-6/+4
| | | | | | | ... and clean up imports in examples, snippets and tests accordingly. Change-Id: I5bbe63afd2614cdc2c1ec7d179c9acd6bc03b167 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* rename containsMask to containmentMaskShawn Rutledge2018-02-271-1/+1
| | | | | | | | | It was pointed out that containsMask sounds like it ought to be a boolean property. Change-Id: I2b56823b60d64f9903b0d5108c6428e691c09ed0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* demonstrate containsMask in the tapableTriangle Shape exampleShawn Rutledge2018-01-261-2/+3
| | | | | | | | | | This isn't an improvement in behvior, it just shows that a Shape can be used as a mask on some other Item. But Shape.containsMode is still important so that when the outer Rectangle's contains() calls Shape.contains(), the latter will do the right thing. Change-Id: I1bd127784e708f30561945a4958e4d5f0c1c0b85 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* QQuickShape: override contains(QPointF); demonstrate in examplesShawn Rutledge2018-01-255-12/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickItem::contains() only checks the Item's bounding box by default. In the case of Shapes, that can be comically imprecise, but it's fast. So we add a containsMode property to control whether we will do that (the default) or actually check each of the QPainterPaths within to see whether they contain the point (FillContains). FillContains could be optimized later: use QRegion perhaps, or download the rendered texture from the GPU and test whether the pixel at the point is transparent. It may also be appropriate to add a StrokeContains option. The main motivation is to detect mouse (or touch) interaction within a shaped area. QQuickSinglePointHandler::wantsEventPoint() already checks whether its parent Item contains the event point. So if a Shape has a TapHandler for example, it will respond only within the visible bounds of the Shape rather than within the entire rectangular bounding box as long as containsMode is set to FillContains. Examples quick/shapes/content/tapableTriangle.qml and tiger.qml are modified to react when a press occurs inside, and the former is fixed to be able to run standalone via the qml runtime. The latter has an offset issue when run standalone but is OK within the shape gallery example. As a drive-by optimization, QQuickShapePrivate's variables are re-ordered by type so that the compiler can place the bools and enums into bitfields; and to facilitate reordering, the initialization is done C++11-style, in the header. [ChangeLog][QtQuick][Shape] A containsMode property is added. If it is set to FillContains, then Shape.contains() returns true only within the visible bounds, so its Pointer Handlers also respond only within those bounds. Change-Id: I31c85a9b08aa6945c58dc07febfe89ffef21274b Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* Fix outdated FDL license headerLiang Qi2017-12-141-4/+4
| | | | | Change-Id: I38a971ed7b9d35a2b60d17b60d94e8d53b140988 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix outdated BSD license headerLiang Qi2017-12-141-2/+12
| | | | | Change-Id: I4a771725bed2d102a8f0db27ec6ed1c90992c944 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Add new PathAngleArc typeMichael Brasser2017-11-071-5/+9
| | | | | | | | | | | | | This type allows working with arcs in different ways (based on angles rather than start/end positions) that can be more intuitive for certain use cases (such as a circular progress indicator). [ChangeLog][QtQuick][Path] Add new PathAngleArc type Change-Id: Icbe5fc0450edd9a4d92f9a8d03438842b72a312d Task-number: QTBUG-62684 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Rename shape example files to get rid of the old pathitem termLaszlo Agocs2017-08-098-16/+16
| | | | | | | | QQuickShape used to be known as QQuickPathItem. Avoid the old name in publicly exposed components. Change-Id: I70bed142e1e82c48c496ab98384318e08fba99c7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* shapes: Add support for conical gradientsLaszlo Agocs2017-08-081-1/+18
| | | | | | Task-number: QTBUG-61857 Change-Id: Iacefcc3b22b31ed3dbcfbf7f00c8b0ea51c63b95 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* shapes: Add support for radial gradientsLaszlo Agocs2017-08-085-2/+106
| | | | | | Task-number: QTBUG-61857 Change-Id: I580e503d8266a9dca69bb542c22228df4ff4bf94 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>