summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews
Commit message (Collapse)AuthorAgeFilesLines
* Convert "Color Editor Factory" Example to snippetsMohammadHossein Qanbari6 days9-215/+0
| | | | | | | | | | The color editor factory example is removed and part of the codes are used as snippets. Fixes: QTBUG-119985 Pick-to: 6.7 6.6 Change-Id: I421e473e7db09a5af7543b80b87a338d8ff2ab7e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Don't add any entry whose name doesn't start with a letterChris Lerner2024-04-111-1/+4
| | | | | | | | | | | | | | | | | In the Addressbook example, any entry whose name doesn't start with a letter will not appear in any of the categories, but it will still exist. These entries would make the "There are currently no contacts in your address book" page disappear even when no entries could be found in the categories. Check if a new entry has a name that doesn't start with a letter, and if so, don't add it as a contact. Also, notify user that names must start with a letter when this happens. Fixes: QTBUG-124254 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I7f25711785ec7a82852a0f37d9f096cc3af41576 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* CMake: Add deployment API to our examplesAlexandru Croitor2024-03-2211-99/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use the unique resource identifier in editabletreemodel exampleAlexey Edelev2024-02-131-1/+1
| | | | | | | Fixes: QTBUG-122210 Pick-to: 6.6 6.7 Change-Id: I86200961384de6fd57f5c140120461faada4fb4d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Add Qt6::Gui editabletreemodel and simpletreemodel testsAssam Boudjelthia2023-12-202-0/+12
| | | | | | | | | | Android needs the Gui dependency. Amends 283cdcd3d5fad368c9df1bcae69cbfbf9ade623f. Pick-to: 6.7 6.6 Fixes: QTBUG-120257 Change-Id: Id02b03b9fa08546bc5a126b3e71e67bdd65f8b66 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Turn SpinBox Delegate example into snippetsVolker Hilsheimer2023-12-207-192/+0
| | | | | | | | | | | | The essence of the example was already fully quoted in the model/view documentation. Move the code into a snippet source, and update the screenshot. Fixes: QTBUG-119976 Pick-to: 6.7 6.6 Change-Id: Id2f10bb26a650419969bbfa9b76cb74babd3319e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* SimpleTreeModel: Polish TreeModel::setupModelData()Friedemann Kleint2023-12-062-34/+26
| | | | | | | | | | | | | - Use QStringView. - Use a list of a pair-like struct to represent the state instead of 2 lists. - Use qsizetype. - Use constLast() to avoid detaching. Pick-to: 6.6 Change-Id: Icc3586451f081f6166fece52675d5379160f51da Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Polish the SimpleTreeModel exampleFriedemann Kleint2023-12-065-59/+49
| | | | | | | | | | | | | | | | | | | - Fix/silence most clang-tidy/compiler warnings * unsigned/int comparison * Avoid repeating return / default parameter types * Make functions static/use static invocations * Use string literals everywhere * Use auto * for pointers * Streamline code, use ternary operators * Move constructor parameters * Observe rule of 5 by using Q_DISABLE_COPY_MOVE - Add some bells && whistles, resize properly, expand all Complements 25027444a9b53d61a6257dc5f5ce0ffdb3b06f98. Pick-to: 6.6 Change-Id: I78f48d187981ecabf69a5d4d42715bad026fa9e6 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* EditableTreeModel: Add a testFriedemann Kleint2023-12-062-1/+64
| | | | | | | | Add a test running QAbstractItemModelTester on the model. Pick-to: 6.6 Change-Id: I40c141c7e754ca05234da611534bd65e456be2fb Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Polish the EditableTreeModel exampleFriedemann Kleint2023-12-066-44/+41
| | | | | | | | | | | | | | - Fix/silence most clang-tidy/compiler warnings * unsigned/int comparison * Avoid repeating return / default parameter types * Use auto * for pointers * Streamline code, use ternary operators * Move constructor parameters * Observe rule of 5 by using Q_DISABLE_COPY_MOVE - Add some bells && whistles, resize properly, expand all Change-Id: I1721458ff66dcba123ff3a2cf50e7d15387a4e8b Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* EditableTreeModel: Polish TreeModel::setupModelData()Friedemann Kleint2023-12-042-34/+25
| | | | | | | | | | | | - Use QStringView. - Use a list of a pair-like struct to represent the state instead of 2 lists. - Use qsizetype. - Use constLast() to avoid detaching. Pick-to: 6.6 Change-Id: I5ff8a17a4d583a7d2a0a11a52c29b9117280382c Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* SimpleTreeModel: Add a testFriedemann Kleint2023-12-042-1/+62
| | | | | | | | Add a test running QAbstractItemModelTester on the model. Pick-to: 6.6 Change-Id: I6ea5d34308357409b9a13eb0271392c8d171addd Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* examples/: fix compiler (GCC) warnings -Wsign-compareAhmad Samir2023-08-181-3/+3
| | | | | Change-Id: Ie4965e3ce3113e9c7a5d5d5eba4cab143ef1c806 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move simple widget mapper example to manual testTor Arne Vestbø2023-06-307-203/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: I703843b5ee935794c2e2fd0407f9a1508b088ab6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move simple dom model example to manual testTor Arne Vestbø2023-06-3011-437/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: I33120e3f6217ea52bdfdebea8b5faa79d9d3fd68 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move pixelator example to manual testTor Arne Vestbø2023-06-3013-540/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: I3ce2bc269a9f77bce3dd41f0127d01091c1408f6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Modernize EditableTreeModelCarl Schwan2023-06-284-64/+63
| | | | | | | | | - Use unique_ptr instead of manual memory management - Improve consistenty in variable name with the simpletreemodel childrenNumber -> row, m_ prefix for member variables Change-Id: Iface30c2224c2b1db7c623a9e6fcbb449c556f3e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Modernize SimpleTreeModel exampleCarl Schwan2023-06-284-47/+45
| | | | | | | | Use std::unique_ptr to manage items tree memory allocations. This also use the new string literals operator. Change-Id: Iab002b5dc612b75cef0be10862e263c6c6c013c1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move item views puzzle example to manual testTor Arne Vestbø2023-06-2813-679/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: Idbb4222861be86275a86f731e75127b8496a08a7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move interview example to manual testTor Arne Vestbø2023-06-2812-296/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: I06c77672c3ca08dfd3e50af25ed3e1669462259a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move dirview example to manual testTor Arne Vestbø2023-06-265-108/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: I9057d5efb1cdf3e425e879f8cc96a544c1892e77 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move chart example to manual testTor Arne Vestbø2023-06-2611-847/+0
| | | | | | Pick-to: 6.5 6.6 Change-Id: I95a40834853a0157d8fa6137431bfd86ce855b2f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move storageview example into tests/manualVolker Hilsheimer2023-06-127-294/+1
| | | | | | | | | The code is mostly an implementation of a model based on QStorageInfo, shown in an otherwise uninteresting tree view. Pick-to: 6.5 6.6 Change-Id: Id6ce70d71ddc9bcd6e82a9ee12f5e1af159eac7a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove flattreeview exampleVolker Hilsheimer2023-06-125-82/+0
| | | | | | | | The relevant bits are a two-line snippet. Pick-to: 6.6 6.5 Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-088-19/+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>
* Remove unused variable/codeAmir Masoud Abdol2023-04-071-4/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d28db64c1ae2c57c95b2f9f22303d74172226e9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Doc: move snippet for implicit translation contextVolker Hilsheimer2023-03-011-0/+2
| | | | | | | | | The 'sdi' example is a candidate for removal, so point at the spreadsheet example instead, which is not. Pick-to: 6.5 Change-Id: I4405f2421db8be79898a38ca4f3fa1ea5fe0280b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Don't use file dialog in the address book exampleJan Arve Sæther2023-01-133-11/+11
| | | | | | | | | | | | | | | On small screen devices such as iPhone targets, the save file dialog is using a non-native dialog, and it doesn't fit the screen real estate to the extent that the [Ok] button is clipped away. In addition, the open file dialog and the save file dialog doesn't cooperate very well on platforms such as iOS without more plumbing. Since using the file dialog is out of the scope for this example we remove all usages of it. Pick-to: 6.5 Change-Id: Ie165355ed0b671d93e44d2d55791156367b0ea5c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Examples: Use PRIVATE CMake linkageKai Köhne2022-11-3021-24/+24
| | | | | | | 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-302-12/+4
| | | | | | | | 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-1721-43/+42
| | | | | Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use Qt6:: to qualify Qt CMake packagesKai Köhne2022-11-1722-71/+71
| | | | | | | 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-112-3/+3
| | | | | | | | | | | | | | | | 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-2322-22/+22
| | | | | | | 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-0322-0/+66
| | | | | | | | | | | | 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>
* Examples: Use signals, slots instead of Q_SIGNALS, Q_SLOTSKai Köhne2022-07-211-1/+1
| | | | | | Pick-to: 6.4 Change-Id: I79a352d1bac11edf2d2b0443d2f1bb202fb4e254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Addressbook example: port to QLatin1StringViewIvan Solovev2022-07-151-3/+5
| | | | | | | | | | | | This allows to fix the warning: qtbase/examples/widgets/itemviews/addressbook/addresswidget.cpp:115: warning: loop variable ‘str’ of type ‘const QString&’ binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct] Pick-to: 6.4 Change-Id: Ibbfa7f9e85fe9ef79291f9da3d161667286b282e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-16105-5148/+213
| | | | | | | | | | | | | 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: Remove unneeded CMake optionsKai Köhne2022-01-2421-83/+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-1321-30/+63
| | | | | | 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-1322-50/+5
| | | | | | Pick-to: 6.3 Change-Id: Ia5d474a3efd6aadbd0ef1537318f2f24e6c24fee Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Prefer unversioned commandsKai Köhne2021-12-139-9/+9
| | | | | | 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-1021-66/+27
| | | | | | | | | 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-064-205/+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>
* Modify the target Square in the puzzleTang Haixiang2021-11-031-2/+2
| | | | | | | | | | | targetSquare judges which square the position falls in. The point scaling calculation method should not be used. The return value of QPoint operator/ will be rounded up. Modified to separate the x and y of position to calculate. Fixes: QTBUG-81842 Change-Id: I70375185a78ba47efe01be3fd490e0fb0f456e17 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-1721-21/+21
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I1270b4846d8a23bc3563b6942c0910e095d2be4a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Port all in-tree addAction() users from postfix to infix QKeySequenceMarc Mutz2021-07-141-2/+2
| | | | | | | The former is QT_DEPRECATED_SINCE(6, 4). Change-Id: I9e60639651b0832f1e3d3282d15dd0ab0b22d819 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Build examples in isolated sub-builds using ExternalProjectCraig Scott2021-05-261-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Rewrite the fetchmore exampleFriedemann Kleint2021-04-234-48/+79
| | | | | | | | | | | | | - Start in root folder so that large directories (/bin/, Windows) are easily reachable - Remove the line edit and navigate by double clicking instead since this is more in line with expectations - Use a QPlainTextEdit for logging - Make the log message more informative - Add icons Change-Id: Ia3cd7fc143efef80772923291f0b711913aa47be Reviewed-by: Paul Wicking <paul.wicking@qt.io>