summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/editabletreemodel
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Add deployment API to our examplesAlexandru Croitor2024-03-221-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-071-1/+1
| | | | | | | | | | | | | | 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-201-0/+6
| | | | | | | | | | 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>
* 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>
* examples/: fix compiler (GCC) warnings -Wsign-compareAhmad Samir2023-08-181-3/+3
| | | | | Change-Id: Ie4965e3ce3113e9c7a5d5d5eba4cab143ef1c806 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-081-2/+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: Use PRIVATE CMake linkageKai Köhne2022-11-301-1/+1
| | | | | | | 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: Use qt_standard_project_setup()Kai Köhne2022-11-171-3/+2
| | | | | Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use Qt6:: to qualify Qt CMake packagesKai Köhne2022-11-171-3/+3
| | | | | | | 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-111-2/+2
| | | | | | | | | | | | | | | | 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-231-1/+1
| | | | | | | 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-031-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: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-167-343/+14
| | | | | | | | | | | | | 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-241-3/+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-131-2/+3
| | | | | | 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-131-2/+0
| | | | | | Pick-to: 6.3 Change-Id: Ia5d474a3efd6aadbd0ef1537318f2f24e6c24fee Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Prefer unversioned commandsKai Köhne2021-12-131-1/+1
| | | | | | 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-101-3/+1
| | | | | | | | | 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>
* 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: I1270b4846d8a23bc3563b6942c0910e095d2be4a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix Editable Tree Model example model rowCount and model instance leakSamuel Gaist2021-03-292-1/+4
| | | | | | | | | | | | | The rowCount method has been fixed to correctly pass the "Common error test #3: the second column should NOT have the same children". It also fixes the model being leaked. Fixes: QTBUG-92178 Pick-to: 5.15 Change-Id: If92973e6f83ea9a2715bd335269f6e50d80f52c6 Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* CMake: Regenerate examples to set the WIN32_EXECUTABLE propertyAlexandru Croitor2020-10-271-0/+4
| | | | | | | | | 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-191-1/+1
| | | | | | Task-number: QTBUG-87661 Change-Id: I0dacfdc97a3fb7d88da85b67800f2c1b084d869b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examplesAlexandru Croitor2020-07-091-1/+5
| | | | | | 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-233-12/+11
| | | | | | Task-number: QTBUG-84469 Change-Id: Id14119168bb1bf11f99bda7ef6ee9cf51bcfab2e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-031-1/+2
|\ | | | | | | Change-Id: If36d96c0fef3de5ab6503977501c55c62a2ecc97
| * Docs: Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-02-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Applied suitable wrapping round various char and string literals, since docs are meant to show best practice. Change-Id: Ie061905fad26f9b4dda3eedba4612704f0a19126 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Regenerate examplesAlexandru Croitor2020-02-041-2/+18
| | | | | | | | | | | | Change-Id: I04b2adbe370ffea81d7787ad90e4ae69d2c165cb Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-06-141-1/+1
|\| | | | | | | | | | | | | | | | | | | This changes many different CMake places to mention Qt6 instead of Qt5. Note that some old qt5 cmake config files in corelib are probably not needed anymore, but I still renamed and kept them for now. Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
* | Fix compiling of examples on AndroidSimon Hausmann2019-06-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE but provide it implicitly. It's redundant :) * When on Android, build a module (shared library), just like qmake. This requires an additional library destination in the install() call, but that's ignored on other platforms. * Fix typos in the android deployment generation settings function * Use the correct cache variable to determine whether we're inside a Qt build or not. Right now this only works inside Qt builds anyway as QtPlatformAndroid.cmake is not publically accessible. Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* | Fix linking of examplesSimon Hausmann2019-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide add_qt_gui_executable() as function in our public API that takes care of automaticWinMain linkage. We can use this in the future to encapsulate similarplatform-specific behavior and adjustments, such as module generation onAndroid. In order for the examples to see the function in Qt5CoreMacros, three more additional fixes were required: * Do the build_repo_end() call _before_ attempting to build the examples, as we need the build_repo_end() to include QtPostProcess and complete the creation of all the target config files. Otherwise the find_package() calls in the examples see something incomplete. * Add more QT_NO_CREATE_TARGET guards * Always call find_dependency on the dependencies, regardless of the target creation mode. This way a find_package(Qt5 COMPONENTS Widgets) will still load Qt5CoreMacros. Change-Id: I03ce856e2f4312a050fe8043b8331cbe8a6c93e6 Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Allow to build examples as standalone projectKevin Funk2019-06-051-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create CMake config files which can be used from the very same CMake project. These CMake config files simply do not create any targets, controlled via the QT_NO_CREATE_TARGETS. This patch also allows to build qtbase.git:examples as a standalone project, against an already-built Qt. Ran this: ag -s "QT " examples -l -0 | xargs -0 -n 1 .../util/cmake/pro2cmake.py --is-example Task-number: QTBUG-74713 Change-Id: I44cce5a4048618b30f890c5b789592c227a8b47d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Rerun pro2cmake on projects that use .ui filesAlexandru Croitor2019-05-221-1/+3
| | | | | | | | | | | | | | Task-number: QTBUG-75875 Change-Id: I95109b07fc4a6e09fe7911a21fc5f27f2c895d77 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* | Merge commit 'dev' into 'wip/cmake-merge'Tobias Hunger2019-04-167-68/+66
|\| | | | | | | Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
| * Cleanup EditableItemModel exampleChristian Ehrlicher2019-01-247-68/+66
| | | | | | | | | | | | | | | | | | | | | | | | Cleanup the EditableItemModel example: - include own headers first - use nullptr - add sanity checks - use for loop instead foreach - use const where possible Change-Id: Ib36e5710c07979576b48a905ee50908a64dcb697 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * Itemviews: Cleanup examplesChristian Ehrlicher2018-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleanup some minor issues in the chart example: - remove unused members - use initializer list for members - pass a proper role to dataChanged() - honor roles parameter in PieView::dataChanged() - use nullptr instead 0 - use new-style connect - fix indentation and other whitespaces Change-Id: Idb212b07c006fe3ae31bee9cd9b1ba4d03043b5e Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | CMake: Add widgets examplesTobias Hunger2019-03-261-0/+23
|/ | | | | Change-Id: Ib6142b93df066e3658eb189b50ca74c455fe7e56 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qtlite: Skip building examples when configured with no-feature-itemviewsRainer Keller2018-01-121-0/+1
| | | | | | | | | Compiling the default examples should be possible without compile errors. Task-number: QTBUG-53141 Change-Id: I73d8787241291ae6230861a89b38e91d900fede0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Examples: Replace 'Q_DECL_OVERRIDE' by 'override'hjk2016-06-151-13/+13
| | | | | | | | Examples should demonstrate best practice, and we can use the keyword directly nowadays. Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* Unify license header usage.Jani Heikkinen2016-03-297-21/+91
| | | | | | | | | Update files using old header.LGPL3 to header.LGPL Update files using old FDL template to use new one Update files using old BSD template to use new one Change-Id: I36a78272516f9953d02956522f285b40adfc8915 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Examples/Doc snippets: Fix single-character string literals.Friedemann Kleint2015-10-131-1/+1
| | | | | | | Use character literals where applicable. Change-Id: I79fa5018f05735201ae35ee94ba0d356fcad1056 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Port examples/widgets/itemviews to new connection syntax.Friedemann Kleint2015-07-312-18/+16
| | | | | | | Rename some slots to avoid ugly casts. Change-Id: I5d7b2c044ab6a725f7259e5e34f00c3d06fff050 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Updated BSD licensed file headersJani Heikkinen2015-02-157-21/+21
| | | | | Change-Id: I6441ff931dbd33b698d762e6f6784898f3f60fe7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-117-35/+35
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Examples: Add Q_DECL_OVERRIDE to overridden functionsOlivier Goffart2014-07-151-13/+13
| | | | | | | | | | | | | | | | | | Q_DECL_OVERRIDE (which expands to 'override' for supported compiler) helps to declare the intent (that it is an overridden function) and force compilation error when there is no such virtual function in the base class. The examples should show the best practice of having it, as it may save the programmer quite some time in case of change of API or typo in the function name or arguments. This change was done automatically with clang-modernize -add-override -override-macros And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-187-7/+7
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* clean up example project files, mostly wrt QT+=widgetsOswald Buddenhagen2012-12-171-2/+2
| | | | | | | | | move QT+=widgets (and printsupport) statements before the install statements, and de-duplicate some cases. also move some TARGET assignments to a more conventional place. Change-Id: I6140d8611680f66c24490e5894e4eb90cae95635 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>