summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Add deployment API to our examplesAlexandru Croitor2024-03-229-81/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Projects were modified using the tool at: https://git.qt.io/alcroito/cmake_refactor A couple of examples had to be adapted manually, due to them including more than one app per example subdirectory. The INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR assignments were removed. The install(TARGETS) calls were modified according to our documentation snippets for qt_generate_deploy_app_script. A qt_generate_deploy_app_script call was added for each executable target. Note that the deployment step will be skipped in the CI for now, because we enable QT_DEPLOY_MINIMAL_EXAMPLES and thus QT_INTERNAL_SKIP_DEPLOYMENT, and also because standalone examples are not enabled yet, and deployment is disabled for in-tree (so no-standalone-example) prefix builds. The install(TARGETS) calls for each example will still run, installing the examples into an installed_examples directory, that will not be archived by the CI. Pick-to: 6.7 Task-number: QTBUG-102056 Task-number: QTBUG-102057 Change-Id: Ida389bbad41710b2ae5da4d95e2d85be9e0cd9ce Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Correct license for examples filesLucie Gérard2024-03-0712-12/+12
| | | | | | | | | | | | | | Example takes precedent over build system file type. According to QUIP-18 [1], all examples file should be LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Id348a89884bb309b96abb31077f14a51086b5d0c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Examples: fix touch handling in painting examplesVolker Hilsheimer2023-12-151-3/+6
| | | | | | | | | | | | | | | | | | | | On macOS, we don't deliver a press event for the first press on the track pad (Qt::WA_TouchPadAcceptSingleTouchEvents is not set by default, so Qt doesn't deliver a single-press on the track pad as a touch event - that makes some sense or at least maintains compatibility). Because of that, point 0 is never added to the finger-mapping hash. When point 0 is then released, we didn't check if we found a valid iterator for that point ID, and the example crashed. Fix this by checking that we have a valid iterator before dereferencing, and by handling Stationary events in the same way as pressed (add the point to the mapping if it's not already there). Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-110266 Change-Id: I32337b801aaabf9b821a97ddc15ad78747b5e6a2 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Turn the "concentriccircles" example into snippets, update screenshotVolker Hilsheimer2023-12-149-274/+0
| | | | | | | | | | | | | The example has a lot of code and documentation, but in essence shows how to use float-based QPainter APIs and how to set a render hint. That is two lines of code, which we can show as snippets. Update the screenshot of the example with a higher-resolution version. Pick-to: 6.7 6.6 Fixes: QTBUG-119983 Change-Id: Iafcb813dff6ab8c269176f7994c95947ebf5e559 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Examples: remove OpenGL code paths from painting examplesVolker Hilsheimer2023-10-2715-489/+22
| | | | | | | | | | | | | | | | The extra code for using the OpenGL paint engine is significant enough to be distracting from what the examples are supposed to show. If we want to show how to use QPainter on an OpenGL widget, then we can make dedicated and documented examples for that, in the OpenGL category. And we have such examples in the Qt OpenGL module anyway. As is, the examples feel more like manual tests of the OpenGL paint engine; if we need more coverage there, then we can add it there. Change-Id: I7b56ea6d08c02cd0a1050ab03991656a0538498d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Move font sampler example to manual testTor Arne Vestbø2023-06-288-584/+1
| | | | | | Pick-to: 6.5 6.6 Change-Id: I696d9be26edfaadd40579884930b2f061d308a06 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-086-12/+0
| | | | | | | | | | | Explicit calls to Q_INIT_RESOURCE are only needed for resources embedded in static libraries. See also https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources Pick-to: 6.5 6.6 Change-Id: I06a24d1c04369eedc78ca60a6ca02ce33907d9e7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* examples: port widget examples to new connection styleSamuel Gaist2023-02-251-1/+1
| | | | | | Task-number: QTBUG-106893 Change-Id: Ib10fd516fdbeda0087b1c8550ce340acd3973e6b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Examples: Fix CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-011-0/+2
| | | | | | | | | | Disambiguate variables and add some exclusions. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ie72b3caab9fd571c3fb6f7d8606584885bc09e66 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Painting examples: Don't mix const_iterator and non-const iteratorsJan Arve Sæther2023-01-171-1/+1
| | | | | | | | Reported by Clazy Pick-to: 6.5 Change-Id: I80fce912b1e5390f0056b1fa9ae0d3cfcf39d045 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* CMake: Clean up usage of the examples/widgets/painting/shared libJoerg Bornemann2022-12-055-95/+0
| | | | | | | | | | Remove conversion artifacts. Also, remove setting the include path. The library's interface takes care of that. Change-Id: Ib5043f15ede2171ab876ccbe603ed0b84de1bce4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix examples/widgets/painting/shared libraryJoerg Bornemann2022-12-051-3/+3
| | | | | | | | | | | | This library deliberately links PUBLICly against Qt6::Widgets and Qt6::OpenGL. Same for the target_include_directories call. This partially reverts a5de12f0d7dfef64453b7b29c33dc760b3cacec4. This fixes the builds of examples using this library. Change-Id: I2b5791044afc82e71df4a3bbfc26e5b1ab9afa76 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Avoid continuous texture alloc in Composition Modes exampleLaszlo Agocs2022-12-024-8/+22
| | | | | | | | | | There seems to be some confusion from back when the example were mass-ported to the QOpenGL stuff in Qt 5 times. Pick-to: 6.4 6.2 Fixes: QTBUG-109119 Change-Id: Ic4bcd010df3fcf82e16385ce241b379f0c351788 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Remove Android High-DPI workarounds in examplesTor Arne Vestbø2022-12-023-9/+1
| | | | | | | These should no longer be needed for Qt 6. Change-Id: Ica7214cbf4fc3ddae960309fe89681ec690d28d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Examples: Use PRIVATE CMake linkageKai Köhne2022-11-3012-31/+31
| | | | | | | We (almost) only build apps, for which PRIVATE linkage makes more sense. Change-Id: I09a509c3fb33a00cdfdede687b3f95d638f42091 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Remove duplicated Qt6::PrintSupport link informationKai Köhne2022-11-301-3/+1
| | | | | | | | Some CMakeLists.txt files did link to Qt6::PrintSupport twice. Also unify formatting and order of the linker step. Change-Id: I4af935c5dc3de6c243aad8511b0803ceaa872589 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use qt_standard_project_setup()Kai Köhne2022-11-1711-23/+22
| | | | | Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use Qt6:: to qualify Qt CMake packagesKai Köhne2022-11-1712-43/+43
| | | | | | | This is what we promote also in the documentation. Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-114-9/+9
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-2314-14/+14
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 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-08-0314-0/+42
| | | | | | | | | | | | 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: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1649-2401/+98
| | | | | | | | | | | | | 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. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+5
| | | | | Change-Id: I7bba855a14289edbedbaa07a1234213f59085c1d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Examples: Remove unneeded CMake optionsKai Köhne2022-01-2411-43/+0
| | | | | | | | | | | | | | | CMAKE_INCLUDE_CURRENT_DIR is not necessary anymore for moc since CMake 3.8: https://cmake.org/cmake/help/latest/release/3.8.html#other-changes CMAKE_AUTORCC should not be used anymore. Instead, we now use qt_add_resources() or similar Enable CMAKE_AUTOUIC only if .ui files are present. Pick-to: 6.3 Task-number: QTBUG-87643 Change-Id: I835e2994cd5dba9918136999499b9077961b616c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Fix whitespace issues in CMakeLists.txtKai Köhne2021-12-1312-18/+39
| | | | | | Pick-to: 6.3 Change-Id: I8e6dd1f250f8be6016ee4164cb2ab7034cbb1203 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Remove remaining conversion markers in CMakeLists.txtKai Köhne2021-12-1313-64/+6
| | | | | | Pick-to: 6.3 Change-Id: Ia5d474a3efd6aadbd0ef1537318f2f24e6c24fee Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Prefer unversioned commandsKai Köhne2021-12-137-12/+12
| | | | | | Pick-to: 6.3 Change-Id: Ib32700ab82cf6b271c49e25d12fbad8c9c6bc1d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2021-12-1011-34/+14
| | | | | | | | | Also consolidate several find_package(Qt6 ...) calls in one call. Task-number: QTBUG-98867 Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove .prev_CMakeLists.txtKai Köhne2021-12-066-601/+0
| | | | | | | | These are left-overs from the initial qmake2cmake conversion. Pick-to: 6.2 Change-Id: Ie15c9ff022ea4566d10c1ba74599de9af83d29a7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Polish the painting/affine exampleFriedemann Kleint2021-10-167-299/+256
| | | | | | | | | | | | | | - Use member initialization - Remove C-style casts - Add space around operators - Use qsizetype for list indexes - Remove commented out debugging code Task-number: QTBUG-97095 Pick-to: 6.2 Change-Id: I11a17fa6e7f17968367a57291d83ee6fba731a34 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-1711-11/+11
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I1270b4846d8a23bc3563b6942c0910e095d2be4a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QObject: optimize the common case of findChildren(QString())Marc Mutz2021-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Outside tests, all in-tree callers of QObject::findChildren() pass no name to match, and in my experience that is also true for the vast majority of out-of-tree users. Avoid the temporary QString creation in the caller and the repeated QString::isNull() checks in the implementation by overloading findChildren() without a name argument and checking for name.isNull() only once, forking off into separate helper functions. Adjust in-tree callers that used an explicit `QString()` argument in order to pass options, which goes to show that `name` should never have been the first argument of findChilden() in the first place, even though I appreciate the symmetry with findChild() (the use-cases of which, however, are radically different). Change a `findChildren().size() == 0` call found while scanning for findChildren() calls to `!findChild()` as a drive-by. Modernize loops in the various qt_qFindChild{,ren}_helper() overloads to match how the new code looks. [ChangeLog][QtCore][QObject] Added findChildren() overload taking no name (thus optimizing this common case). Change-Id: Ifc56e5438023d079b40c67f11ae274a3e128ad5e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Qt::PrintSupport is an optional component in the fontsampler exampleVolker Hilsheimer2021-06-151-0/+1
| | | | | | | | | If we don't find it we can't link to it, and then the example will never have any print functionality, in spite of having the UI. Pick-to: 6.2 Change-Id: Ib84be39a2655253c7d643520487adee054d5bd2d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Build examples in isolated sub-builds using ExternalProjectCraig Scott2021-05-261-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Examples are intended to show how to build against an installed Qt. Building them as part of the main build means the way the Qt targets are defined and created are not representative of an end user's build. By building them as separate projects using ExternalProject, we can more closely replicate the intended audience's environment. This should allow us to catch more problems earlier. Having examples built as part of the main build also creates problems with some static builds where a tool built by the main build is needed during configure time. This happens with other repos like qtdeclarative but not (currently) with qtbase. Converting the examples in qtbase to be built using ExternalProject is intended as a demonstrator for how other repos can do similar. Until other repos are converted, they will continue to work as they did before, with examples as part of the main build for non-static builds only. The new build-externally behavior is only supported for non-prefix builds with this change. Prefix builds will continue to use the old non-external method. Support for building examples externally in prefix builds will be a separate change. Task-number: QTBUG-90820 Fixes: QTBUG-91068 Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix BASE argument of qt_add_resourcesJoerg Bornemann2021-05-1810-1400/+350
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BASE argument of qt_add_resources now denotes the root point of the alias of the file. Before, BASE was merely prepended to every file that got passed to qt_add_resources. Old behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "images/button.png") Alias is "../shared/images/button.png", and pro2cmake generated QT_RESOURCE_ALIAS assignments to fix this. New behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "../shared/images/button.png") The alias is "images/button.png". No extra QT_RESOURCE_ALIAS assignment is needed. The new behavior is in effect for user projects and for Qt repositories that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE. Qt repositories will be ported one by one to this new behavior. Then the old code path can be removed. Pick-to: 6.1 Task-number: QTBUG-86726 Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix build of standalone painting examplesJoerg Bornemann2021-05-177-13/+18
| | | | | | | | | | | Since commit f5c69a51956 the examples/widgets/painting examples could not be built standalone anymore. Move the find_package calls out of the examples/widgets/painting/shared subdirectory and add a .cmake file that can be included to use the library conveniently. Change-Id: I35cb5bd8419a67c782d109104c4a88d64477a8be Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Avoid divide-by-zero in the gradients exampleShawn Rutledge2021-04-191-0/+2
| | | | | | | | | | | After 7a738daa97436478a21b5dd31ba2312b2cb2df41 we require QLineF::setLength() to take a finite length, and this code was probably always risky when HoverPoints has two points that are both 0,0. It's probably a transient condition anyway. Fixes: QTBUG-92908 Change-Id: If81122d2f78761026b0d656ceffe173132751317 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Port examples away from deprecated QTouchEvent APIsVolker Hilsheimer2021-04-172-24/+24
| | | | | | | Use the QEventPoints API instead. Change-Id: I7310fd34df110cad508f6188a41ad452a3cf848d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Get rid of all instance usage of QFontDatabaseVolker Hilsheimer2020-11-031-5/+4
| | | | | | | | All QFontDatabase APIs are static, use them accordingly. Task-number: QTBUG-88114 Change-Id: I0e4a7508646037e6e2812611262eed8b6d7ad3de Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* CMake: Fix painting examples to build as standalone projectsAlexandru Croitor2020-10-277-51/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The examples use an intermediate object library to avoid duplicate file compilation. The examples worked when built as part of Qt because the shared directory was always added, and Qt::OpenGL is available implicitly. Change each project to add_subdirectory(../shared) if the object library is not available, thus making the examples build as standalone projects. Call find_package inside the shared project, to ensure the Qt packages are found. Create an alias called 'painting_shared::painting_shared' and link against that to ensure that any failure is caught at configure time rather than build time. Adapt the pathstroke example to use the object library. Comment out the code for the OpenGL scopes, because it's handled by the object library. Make sure the OpenGL dependency is public. Make sure to run moc and compile the OpenGL specific files as well. Task-number: QTBUG-87444 Change-Id: Ib0ecb68948581c5267ca04f19d8043fa44ff3d54 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examples to set the WIN32_EXECUTABLE propertyAlexandru Croitor2020-10-2715-0/+60
| | | | | | | | | As well as the MACOSX_BUNDLE properties as necessary. Task-number: QTBUG-87664 Task-number: QTBUG-86827 Change-Id: I7677449a26d51fa853bd67bab6b3b61afbd2b12f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examples to use qt_add_executableAlexandru Croitor2020-10-1915-19/+39
| | | | | | Task-number: QTBUG-87661 Change-Id: I0dacfdc97a3fb7d88da85b67800f2c1b084d869b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove deprecated QPrinter and QPagedPaintDevice APIsVolker Hilsheimer2020-09-041-4/+4
| | | | | | | | | | | Adjusting the QPrinter test case - some use cases no longer exist, or are already tested in QPageSize and QPageLayout tests. Adjust examples and manual tests. Change-Id: I01cbc65f3d8031aea2dac86dd942126ba708b111 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* High-DPI: Remove usage of Qt::AA_EnableHighDpiScalingTor Arne Vestbø2020-08-282-6/+0
| | | | | | | | This attribute is now on by default. Change-Id: I7c9d2e3445d204d3450758673048d514bc9c850c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move QStringRef and remains to Qt5CompatKarsten Heimrich2020-08-201-1/+1
| | | | | | | | | Export some private functions from QUtf8 to resolve undefined symbols in Qt5Compat after moving QStringRef. Task-number: QTBUG-84437 Change-Id: I9046dcb14ed520d8868a511d79da6e721e26f72b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Long Live QMap as a refcounted std::map!Giuseppe D'Angelo2020-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and QMultiMap as std::multimap. Just use the implementation from the STL; we can't really claim that our code is much better than STL's, or does things any differently (de facto they're both red-black trees). Decouple QMultiMap from QMap, by making it NOT inherit from QMap any longer. This completes the deprecation started in 5.15: QMap now does not store duplicated keys any more. Something to establish is where to put the QExplictlySharedDataPointer replcement that is in there as an ad-hoc solution. There's a number of patches in-flight by Marc that try to introduce the same (or very similar) functionality. Miscellanea changes to the Q(Multi)Map code itself: * consistently use size_type instead of int; * pass iterators by value; * drop QT_STRICT_ITERATORS; * iterators implictly convert to const_iterators, and APIs take const_iterators; * iterators are just bidirectional and not random access; * added noexcept where it makes sense; * "inline" dropped (churn); * qMapLessThanKey dropped (undocumented, 0 hits in Qt, 1 hit in KDE); * operator== on Q(Multi)Map requires operator== on the key type (we're checking for equality, not equivalence!). Very few breakages occur in qtbase. [ChangeLog][Potentially Source-Incompatible Changes] QMap does not support multiple equivalent keys any more. Any related functionality has been removed from QMap, following the deprecation that happened in Qt 5.15. Use QMultiMap for this use case. [ChangeLog][Potentially Source-Incompatible Changes] QMap and QMultiMap iterators random-access API have been removed. Note that the iterators have always been just bidirectional; moving an iterator by N positions can still be achieved using std::next or std::advance, at the same cost as before (O(N)). [ChangeLog][Potentially Source-Incompatible Changes] QMultiMap does not inherit from QMap any more. Amongst other things, this means that iterators on a QMultiMap now belong to the QMultiMap class (and not to the QMap class); new Java iterators have been added. Change-Id: I5a0fe9b020f92c21b37065a1defff783b5d2b7a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Regenerate examplesAlexandru Croitor2020-07-0915-15/+75
| | | | | | Change-Id: I1c51b10af4e2b26f54740f257164c56a0e2a03ce Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use QList instead of QVector in examplesJarek Kobus2020-06-235-7/+7
| | | | | | Task-number: QTBUG-84469 Change-Id: Id14119168bb1bf11f99bda7ef6ee9cf51bcfab2e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>