aboutsummaryrefslogtreecommitdiffstats
path: root/src/labs/folderlistmodel
Commit message (Collapse)AuthorAgeFilesLines
* Make security header for the qt labs folderlistmodelSanthosh Kumar2025-09-172-0/+2
| | | | | | | | | | | | The FolderListModel operates with QFileInfo and QUrl interfaces to provide file information in the provided path. The path used needs to be validated by the application developer for any illegitimate access. QUIP: 23 Task-number: QTBUG-136184 Pick-to: 6.10 6.9 6.8 Change-Id: I50a4737aa9193a5b9996a37cd865c49de7b84121 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* CMake: Don't publicly propagate private Qt modules for public modulesAlexandru Croitor2025-07-291-1/+1
| | | | | | | | | | | | This causes user projects to automatically find the private Qt module packages and expose the Private targets and their headers, without the user project explicitly opting into this, and without showing them a warning. Pick-to: 6.10 Task-number: QTBUG-138712 Change-Id: Ia50bb6d128fe018c71d976f91abdab75790b6142 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add missing call to beginResetModel()Even Oscar Andersen2025-06-171-0/+4
| | | | | | | | | | | | | | | QQuickFolderListModel::beginResetModel calls endResetModel automatically to avoid consequtive calls to beginResetModel. However, the same logic is not done for endResetModell. This triggers a endResetModel without a preceeding beginResetModel which (apparently) causes problems with updating the view contents in some cases. Fixes: QTBUG-134600 Pick-to: 6.8 6.9 6.10 Change-Id: I9fe3034b784d83ee2ed5b65bdad3a77545891bc2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickFolderListModel: Properly range check model indexUlf Hermann2025-06-041-10/+11
| | | | | | | | | | The row can be -1, denoting an invalid index. This would previously crash the sidebarStandardPaths() test, which was masked by our testing strategy. Pick-to: 6.10 6.9 6.8 6.5 5.15 Change-Id: If01b83990ec0393088b518526ff3d3acaab703cc Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QtQml: Reject uncreatable value types even if marked as QML_UNCREATABLEUlf Hermann2025-04-151-1/+1
| | | | | | | | | | | | We simply cannot do anything sensible with them. Clarify the warning to say that only object types can be marked uncreatable. Also fix Qt.labs.folderlistmodel. It had such a type. Pick-to: 6.9 6.8 Task-number: QTBUG-135032 Change-Id: Id062908c66c4c4ab15e0deb5c92d0ca7ca447899 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove FolderListModel::fileURL roleShawn Rutledge2025-04-112-5/+0
| | | | | | | | | | It's been deprecated since 5.15. Fixes: QTBUG-87820 Task-number: QTBUG-32039 Change-Id: Ic030d8fcee39fe75d8b1211cb3f54b92fd74680f Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add default arg to QQFolderListModel::index(int row, column=0, ...)Shawn Rutledge2025-04-102-2/+2
| | | | | | | | | | | | | | | | | | | | | It's uncertain why this was not there from the beginning: - QAbstractListModel::index(row, column=0) has default column 0 - FolderListModel doesn't make any use of columns: the index() column argument is ignored, so it doesn't make sense for index() to require it. - When the autotest calls index(row), it was not polymorphic, because the arguments weren't quite the same. So far, the test avoids including qquickfolderlistmodel_p.h and sticks to QALM API; but then changing to qobject_cast<QQuickFolderListModel *> would change the available API. - Users may do as the autotest does, and stick to QALM API: after all, QQuickFolderListModel does not have public C++ API. Amends 9593df26c4a87130947dbdacf5ddb2f7a3412cbc Task-number: QTBUG-32039 Task-number: QTBUG-135370 Change-Id: Iedc437f7a543755f6138ff78845eefe873a64c78 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QQuickFolderListModel: add NOTIFY signalsDheerendra Purohit2025-04-102-21/+55
| | | | | | | | | | | Add missing notify signals for the writable properties in QQuickFolderListModel. Fixes: QTBUG-114161 Task-number: QTBUG-32039 Change-Id: Ic974174ffea68494ce0c342c71bf7c95c5c56de6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Remove some unneeded destructor declarationsGiuseppe D'Angelo2025-01-201-2/+0
| | | | | | | | They serve no purpose, but interfere with the RO5 and cause Clang to issue -Wdeprecated warnings. Change-Id: I15e30ff5ccb89429ab3ac6c0234388afee4976dd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Replace \instantiates with \nativetypePaul Wicking2024-08-201-1/+1
| | | | | | | | | | | 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>
* QQuickFolderListModel: ensure that beginResetModel isn't called twiceMitch Curtis2024-07-051-7/+31
| | | | | | | | | | | | | | | | | | | | In the process of opening a FolderDialog, FolderListModel's folder property is set twice: once upon component completion of FolderDialog.qml, and shortly after if FolderDialog's currentFolder property is set, due to the binding in FolderDialog.qml. This would cause beginResetModel to be called twice, which invalidates the assertion made in QQmlDelegateModel that this doesn't happen. This patch ensures that beginResetModel is always followed by endResetModel by tracking if we're in the middle of a reset. This is (indirectly) tested by tst_QQuickFolderDialogImpl::bindCurrentFolder. Task-number: QTBUG-125053 Pick-to: 6.5 6.7 6.8 Change-Id: I4c22be173807187e56f4d528a465225b787e840a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* labs: Straighten out some logging categoriesUlf Hermann2024-06-142-2/+2
| | | | | | | | | | | 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: I72c6ed00ce6e0d81ebb8e0dff93f410bd001342a Reviewed-by: Mitch Curtis <mitch.curtis@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>
* Declare some missing value typesUlf Hermann2024-04-171-2/+6
| | | | | | | | | | | | | | * An opaque pointer for the execution engine * QQmlChangeSet * long and ulong: For those we cannot know the size in advance. Therefore we cannot handle them as aliases of other numbers. * QTextBlock * FileProperty * QQmlXmlListModuleQueryResult Task-number: QTBUG-101143 Change-Id: If66d1fa3ab734351006e5a9f071e171c97dd738e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove the use of GENERATE_PRIVATE_CPP_EXPORTSAlexey Edelev2024-01-111-2/+1
| | | | | | | Task-number: QTBUG-117983 Change-Id: I584116bfd4d47deca914910b712c2ea3295f3e7f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Remove the use of Q_LABSFOLDERLISTMODEL_PRIVATE_EXPORTAlexey Edelev2024-01-092-2/+2
| | | | | | Task-number: QTBUG-117983 Change-Id: I87aeb8a5ac78aacda170c9d90d9203d64c73ccf4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Fix unqualified access in FolderListModel exampleSze Howe Koh2023-08-311-0/+1
| | | | | | Pick-to: 6.6 6.5 6.2 Change-Id: Iacbb8cc5f9d887cdd7f14f1d948e37e27e5c6083 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Fix incorrect default value for FolderListModel.folderSze Howe Koh2023-08-311-1/+2
| | | | | | | | | This behavior has been in place since Qt 5 (or perhaps even earlier) Change-Id: If60192e4302f5b1316d29dc42139eb66855789a1 Pick-to: 6.6 6.5 6.2 5.15 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Expand FolderListModel documentationSze Howe Koh2023-06-071-25/+28
| | | | | | | | | | | * Document the data types exposed by FolderListModel * Fully-qualify the enum values of FolderListModel::sortField and mark default value * Mark read-only properties Change-Id: Ib829a69cf762f4aaf1e50f2e526f64da429e128b Pick-to: 6.6 6.5 6.2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make properties in the Qt Labs module FINALOliver Eftevaag2023-05-311-16/+16
| | | | | | | | | | | Without setting the FINAL flag, properties can be shadowed by users. This can both cause confusion for non-experienced users, and it causes issues with qmlsc. Task-number: QTBUG-108739 Change-Id: I141953340235040020e7ec64f67019314f0f932b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* doc: Use \value rather than \li for enumeration values and constantsShawn Rutledge2023-03-281-14/+12
| | | | | | Pick-to: 6.2 6.5 Change-Id: Ica8354a53d0a5fb5dd1d8cd5f774dcdc56b6f99a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Mention the FolderListModel dep of QQuickFolderListModelMikolaj Boc2022-12-191-0/+6
| | | | | | | | | The documentation now mentions that QQuickFolderListModel's functionality is limited when FileSystemWatcher is disabled. Fixes: QTBUG-108266 Change-Id: I114eea24772bc58bc7ee13cc604b6bf541415edb Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix bug in FolderListModel's FileInfoThreadMitch Curtis2022-10-183-26/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the FileDialog in the goUp test is first created, it sets a bunch of properties, two of which are sortCaseSensitive and nameFilters. These cause FileInfoThread's sortUpdate and folderUpdate flags to be set to true, respectively. When FileInfoThread::getFileInfos() ran, it would see that folderUpdate was set to true, run related code, and then unset folderUpdate. However, sortUpdate would not be unset. This meant that the next time getFileInfos() was called, it would effectively reset the model when it didn't need to. This caused the currentIndex we set on fileDialogListView to be ignored because the ListView set it to 0 as a result of the insertion and removal of rows from the model caused by QQuickFolderListModelPrivate::_q_sortFinished(). This patch fixes the issue by: - Introducing an enum to manage the different types of updates requested, which also makes the code a little easier to understand. - Unsetting the various flags whenever needUpdate is unset. It also adds categorized logging to make debugging such issues in the future easier. Task-number: QTBUG-101488 Pick-to: 6.4 Change-Id: Iaf53509d3f028fd2e1385a2597898e8e0327aedb Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that on() was replaced with a matcher that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 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>
* Fix several more improperly placed #include mocThiago Macieira2022-07-281-2/+2
| | | | | | | | | | | | | | Like commit qtbase/638893bea083b619b73b33a7dd5589fb2c4c4242. Script to find them: git grep -l '#include.*moc' \*.cpp \*.mm | \ xargs awk '/QT_BEGIN_NAMESPACE/ { i=1 } /QT_END_NAMESPACE/ { i=0 } /#include.*moc/ && i { print ARGV[ARGIND], $0 }' Pick-to: 6.4 Change-Id: I6f936da6f6e84d649f70fffd17058fd05cfc5c6d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@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>
* Resolve duplication of QAbstract{Item|List}Model in qmltypesUlf Hermann2022-06-241-0/+3
| | | | | | | | | | | They belong to QtQml.Models and modules that need them should depend on QtQml.Models. This requires they link QtQml.Models as otherwise qmltyperegistrar won't believe the types are actually available. Change-Id: I42d87db12314878709601e3409250234dc27d509 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-116-228/+12
| | | | | | | | | | | | 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>
* Re-run includemocs (new script version)Marc Mutz2022-05-051-0/+2
| | | | | | | | Task-number: QTBUG-102948 Pick-to: 6.3 6.2 5.15 Change-Id: I5684ead7b19aa3e4afd2cca8f0662a01cedb2785 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add more missing QT_{BEGIN,END}_NAMESPACEMarc Mutz2022-05-043-0/+12
| | | | | | | | | Found by the includemoc script complaining. Task-number: QTBUG-102948 Pick-to: 6.3 6.2 5.15 Change-Id: Ie3c133c7c44c0617c54bc821da7ea992328d0d03 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make sure all private headers include at least one otherThiago Macieira2022-03-101-1/+2
| | | | | | | | | | See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Fix qdoc warningsVenugopal Shivashankar2021-11-141-1/+1
| | | | | | | | - Comment out \instantiates entries that refer to private C++ classes - Fix clang-format and regexp warnings Change-Id: I7228538715b9d34ab39e7c0f71155be7a277116a Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Migrate to autogenerated cpp exportsAlexey Edelev2021-11-023-15/+4
| | | | | | | | | Replace the hardcoded cpp exports with a generated one where it's applicable. Task-number: QTBUG-90492 Change-Id: I4af021bf828e05c8d6f3f975befd3b6b2cf63462 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace 0 pointer constants with nullptrAllan Sandfeld Jensen2021-10-181-1/+1
| | | | | | | Replaced in most common patterns. Change-Id: Idcaff1f2e915f29922702d3600a2e5f1e2418a7a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove unnecessary declarations of type registration functionsUlf Hermann2021-07-161-2/+0
| | | | | | | | | For generated plugins, we do not need to manually declare type registration functions. Pick-to: 6.2 Change-Id: Iafd311375e4542a74fe2530e64e2b4bbe15af690 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Refactor and update qml CMake APICraig Scott2021-06-041-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing CMake API for qml modules had a number of shortcomings. Refactor it to achieve the following: - Clearly separate public and internal aspects. - Re-use code from qtbase for adding plugins and module targets rather than reimplementing close variations. - Provide more robust and complete support for qmllint, qmlcachegen and automatic generation of qmldir files. - Reduce the steps needed for more common scenarios. - Encourage the use of separate backing library and plugin targets. - Automatically generate the plugin class .cpp file where possible. - Specify .qml files directly through qml-specific API elements rather than assuming they can be extracted out of a set of resources. [ChangeLog][QtQml] The qml CMake API has changed from 6.1 and is now out of Technical Preview status. The most notable change is that .qml files should no longer be specified as resources, there is dedicated handling for them in the qt6_add_qml_module(). A related change is that the qt6_target_qml_files() command has been replaced by qt6_target_qml_sources(). More complete integration with qmlcachegen, qmllint and qmldir generation is also part of the CMake API. Fixes: QTBUG-91621 Task-number: QTBUG-82598 Task-number: QTBUG-88763 Task-number: QTBUG-89274 Task-number: QTBUG-91444 Change-Id: I25aae1b0e89890394dfe2ba2824008164b2ca8d9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Remove GENERATE_METATYPES usageMaximilian Goldstein2021-04-271-1/+0
| | | | | | | | We now generate metatypes by default and every instance of GENERATE_METATYPES now causes a warning. Change-Id: Id81f66eb8b0b7cc9475fd9978ebe374a59ab7b63 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Fix qml module version to use the repo project versionAlexandru Croitor2021-04-151-1/+1
| | | | | | | | | | | Use PROJECT_VERSION instead of CMAKE_PROJECT_VERSION, so that the repo project version is used in a top-level build, rather than the version of the qt5 project. Pick-to: 6.1 6.0 Task-number: QTBUG-92861 Change-Id: I5a7a09baf81353558e512800746ac24e8e8b9a47 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Qt.labs.folderlistmodel: Register old versions declarativelyMaximilian Goldstein2021-02-041-1/+1
| | | | | | | Register old versions declaratively so the plugin can be truly optional. Change-Id: I0f5774d90788208dfce7928a45a904fc6595faa1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make a bunch of plugin headers privateMaximilian Goldstein2021-01-254-8/+19
| | | | | | | | This avoids a bunch of warnings and as these headers weren't exposed before they might as well be kept private. Change-Id: I42417516921ae6d498d1ed07728bdad654067b3d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Qt.labs.folderlistmodel: Make plugin optionalMaximilian Goldstein2021-01-217-0/+1820
This moves the folderlistmodel types into a new library and is meant to make them availabe to the QML compiler at some point in the future. Task-number: QTBUG-90487 Change-Id: Iee84a4804a241aa1dee5f896a02ccc9f0ecc0d8d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>