aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* QQuickTreeView: be able to expand rows that are not yet visible in the viewHEADmasterRichard Moe Gustavsen2022-01-242-10/+37
| | | | | | | | | | | | | | | | If the app expands a row in TreeView, that row will for a brief moment be expanded in the proxy model, but not in the view, until the view is polished. For that reason, when determining if a row can be expanded or not, we should check the state of the proxy model, and not the view. Note: if the application needs the state of the view to reflect the state of the proxy model immediataly after a call to expand, forcePolish() is always possible. Task-number: QTBUG-91374 Change-Id: Ibda8d90e2dc2077a6f24090566ce3ba20a734c29 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix compiler warningsRichard Moe Gustavsen2022-01-062-2/+2
| | | | | Change-Id: Ic74cd899c839efeb842a2c267f628783f8a0689a Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Change the cmake build to use qt_internal_add_qml_moduleRichard Moe Gustavsen2022-01-063-14/+17
| | | | | | | | | | Building TreeView with cmake is completely broken in Qt 6.3. To fix this, use qt_internal_add_qml_module instead of qt_add_qml_module to ensure that the module installs into Qt rather than the build dir. Change-Id: Ib103c8ec1b8d3be12463b2edaf1a92b877068151 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Avoid conflict between TreeView in QtQuick and MarketplaceRichard Moe Gustavsen2022-01-069-42/+63
| | | | | | | | | | | | | | Both QtQuick and QtQuick.TreeView exports a TreeView item in Qt 6.3. In order to avoid conflict, all usage of the marketplace version in Qt 6.3 will need to either: 1. import it into a namespace 2. use TreeViewTemplate instead of TreeView as a prefix for enums 3. Create a custom subclass of TreeViewTemplate that is named something else than "TreeView" (e.g "CustomTreeView"). Change-Id: I74f04eea4e279ccbef713b1894d9fb09cbd94dc8 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Update qquicktreeview to take Qt 6.3 API changes into accountRichard Moe Gustavsen2022-01-062-0/+15
| | | | | | | | | Some functions in the private class QQuickTableViewPrivate has changed in Qt 6.3 to be virtual. Update qquicktreeview so that it takes these changes into account when building with Qt 6.3. Change-Id: I81c78d3f16da36d9859031ac28434987981d99f1 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Let Q_DECLARE_PUBLIC be publicRichard Moe Gustavsen2022-01-061-2/+1
| | | | | Change-Id: I3fc757a331d59df3e5317b30f30622798713f173 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Ensure we emit layoutChanged when layout changesRichard Moe Gustavsen2021-12-161-0/+13
| | | | | | | | | | | When the source model changes layout, the proxy model will change layout as well. Hence, we also need to emit that the layout for the proxy model has changed so that TableView will do a relayout. Fixes: QTBUG-97579 Change-Id: I0dac30c9c909b915f47f701726702d53c91134b5 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Autotest: Add new test: expandAndCollapseChildrenRichard Moe Gustavsen2021-10-201-0/+51
| | | | | | | | | | Add a test that verifies that you can expand and collapse nodes in the treeview, and that we end up with the expected number of rows. Task-number: QTEXT-12 Change-Id: I2d287d8fe868b49d89e226a1b5f492a9abfe2f8d Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Autotest: Add new test: insertRowsRichard Moe Gustavsen2021-10-203-0/+54
| | | | | | | | | | Add a test that verifies that if we add new rows to the model, TreeView will update correctly and show all the rows as expected. Task-number: QTEXT-12 Change-Id: Ic03d52388c3ca89eef44be029c1c83674bbfe3fe Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Let TreeView update attached properties when model data changesRichard Moe Gustavsen2021-08-052-17/+37
| | | | | | | | | | | As it stood, we would never update attached properties when the underlying model data changed. The effect would be that properties like depth and hasChildren would not change in the view when it changed in the model. Fixes: QTEXT-6 Change-Id: I310a8b08dda8909d238d328e01b5ec1100508839 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix spelling mistakeRichard Moe Gustavsen2021-08-052-7/+7
| | | | | Change-Id: Ied81773b8ca094a187d8416f99f897047bf00f33 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Update model data for all columnsRichard Moe Gustavsen2021-08-021-3/+6
| | | | | Change-Id: If6dc11437491b487a1c5beba9257b58ecd22ea45 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Add note about building with cmakeRichard Moe Gustavsen2021-07-081-0/+3
| | | | | Change-Id: I265ddebbb7f5f28f16b9d41296c043e63374d5d0 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Add the dependencies for the generated qmldirAndy Shaw2021-07-081-2/+6
| | | | | | | | This only needs to be done on the qmake side as cmake will generate this for us automatically. Change-Id: I6976729dc9d522ca42ebf653ddfd4d6ec08e5cb6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Ensure that the symbol is found in a static buildAndy Shaw2021-06-171-0/+8
| | | | | | | | | | The symbol in this case is doing the registration, but without a reference to it, then it will be lost by the linker, so we need to make sure we have an explicit one to it. Fixes: QTEXT-5 Change-Id: I4cb2d40b2949ad6affb715baaeac30146232e567 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Port to newer CMake APIFabian Kosmale2021-06-163-53/+22
| | | | | | | | | | | | | | - opt out of deprecated internal functions - port deprecated API to newer equivalent - use new QML CMake API Additionally, disable the Qt 6 check: By using REQUIRED in find_package, cmake will abort if no suitable Qt 6 version can be found. The old check would instead get confused if there was a Qt 5 qmake in the path, even when a perfectly suitable Qt 6 were too exist somewhere else. Change-Id: I3f2658836f13f607757a4609a121a00159e6f140 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Check that modelIndex is valid before trying to use it6.1Richard Moe Gustavsen2021-05-192-0/+22
| | | | | | | | | | | | At start-up, m_currentIndex is not yet set. So if the app tries to access e.g currentItem, it will cause an assert to happen in QQuickTableView. This patch will do some extra checking to avoid this. Fixes: QTBUG-93843 Change-Id: I461fa5a90d822a65795acabe36c18afa38f4810d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix compiler warning about returning reference to local objectRichard Moe Gustavsen2021-05-102-2/+2
| | | | | | | | | | | The compiler warns about the code returning a reference from rootIndex(). As there seems to be no good reason why we should return a reference in this case, return a value instead. Fixes: QTBUG-93593 Change-Id: I9eb2dbd95917d28397e648b71c16fc709ab0b429 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix README.md to have the right clone URLAndy Shaw2021-05-071-1/+2
| | | | | | | Also includes how to build the examples Change-Id: I094071168ccef0990d4d6216a9fa7b6ee55c9004 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't assign TreeView.view to a CustomTreeView pointerRichard Moe Gustavsen2021-05-071-1/+1
| | | | | | | | | | | | | CustomTreeView doesn't inherit from TreeView, but from TreeViewTemplate. So you cannot assign CustomTreeView to a TreeView pointer. This patch changes the type from TreeView to CustomTreeView to fix a run-time warning about this. Fixes: QTEXT-2 Change-Id: I230ac6412cf9b205741c57f6b62f9e2e751d7799 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Add some extra tests for when the model is emptyRichard Moe Gustavsen2021-04-191-0/+12
| | | | | Change-Id: I317bad2da6ad7ea60c7a32b2c27a1c4a0ec7cce7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Only stop keypress propagation if TreeView actually uses the keyRichard Moe Gustavsen2021-04-193-0/+89
| | | | | | | | | | | Only stop keypress propagation if TreeView uses the key. Otherwise, forward the event to the parent. This will ensure that TreeView don't stop Keys.onPressed handlers in anchestor items from working correctly. Fixes: QTBUG-92517 Change-Id: I6d7ea4062bbb9eef4a64aa6bd18ff29696352dcd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Ensure the tree has items before moving currentViewIndexRichard Moe Gustavsen2021-04-192-0/+28
| | | | | | | | | We need to check that the view has items loaded before we call functions like "leftColumn()". Otherwise the application will crash. Change-Id: I8421f11c3b12527f3ee923f21c3ccf20e171d1f0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix part of clazy warnings: ineffective loops and missed overridesEvgeniy A. Dushistov2021-04-143-9/+21
| | | | | Change-Id: If9fcde221d5de7302e62b314be34e5311bd3efae Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Emit dataUpdated() when updating other columns than the firstAndy Shaw2021-03-306-13/+115
| | | | | | | | This also extends and fixes the test so that it tests this case and works with Qt 5.15.x as well as Qt 6.x Change-Id: I731c8568a2c6279441a78558808dc7a8906f0763 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Support Qt 5.15Richard Moe Gustavsen2021-03-154-10/+248
| | | | | Change-Id: I7d1b331c325cfbbdf020ee60c37f172b1dae2b07 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Don't attach one big hoverhandler to the contentItemRichard Moe Gustavsen2021-03-151-30/+26
| | | | | | | | | | | | | | | | | | When adding a HoverHandler to a TreeView/Flickable, it will actually end up as a child of the contentItem. The problem then is that the contentItem of a TreeView/TableView has a size that is an estimate of the actual size of the table. The result is that the HoverHandler will not cover the exact size of the table, but an estimated size, and therefore not work as expected. The solution is to add HoverHandlers directly to the delegates instead. Fixes: QTBUG-91745 Change-Id: Iac0c0d289379060e4e82c64c1212a3143ae73cf7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Enable revisioned properties from TableViewRichard Moe Gustavsen2021-03-155-9/+20
| | | | | | | | | | | | | | In order for users of TreeView to be able to access properties from TableView that are revisioned for 6.0, we need to do the following: - Bump the version of TreeView to be 6.0 - Add a struct with QML_FOREIGN that helps the QML engine to resolve the properties. Task-number: QTBUG-91706 Change-Id: Ia3e448f6c24d24e4e21a91921e08939fff9e5f7b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Ensure we set TreeView.viewRichard Moe Gustavsen2021-02-225-1/+81
| | | | | | | | TreeView.view was never set in qquicktreeview.cpp. This patch will ensure that we do. Change-Id: I43eee26555a656de3d15a768fe004db2d912d19d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add autotest boilerplate codeRichard Moe Gustavsen2021-02-227-7/+340
| | | | | | | | | | This patch will add the boilerplate code for writing auto tests. In addition to the QTestLib code, it contains a QAIM (TestModel) that implements a tree, as well as a QML file with a TreeView that uses it. Change-Id: I1810e12ed34f71083fac159bbb87701c46184a6c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Don't store pointers to items inside a QListRichard Moe Gustavsen2021-02-112-9/+13
| | | | | | | | | | | | | | | | | | | | | The treemodeladaptor stores a list of nodes in the tree that should be expanded (m_itemsToExpand) upon the next call to expandPendingRows(). As it stood, this list would be populated with pointers to items inside another list (m_items). But this strategy is not safe. As soon as you insert other items into m_items, the address of the pointers stored in m_itemsToExpand would be pointing to some other random location. And this happens quite frequently. By luck, this memory corruption did every now and then cause an assert to trigger. This patch will ensure that we don't store raw pointers to items inside a list. Instead we store a copy of the little TreeItem struct. Fixes: QTBUG-91067 Change-Id: Idf616d7eeb3ac2b8db23a1e4e6f05a7ccd2808cf Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Inform that you need to use qmake to build with Qt 5Richard Moe Gustavsen2021-02-081-0/+14
| | | | | | | | | | | | | | | We use the pro2cmake script found in Qt 6 to generate cmake files for TreeView. That scripts is not available in Qt 5, together with important functions like "qt_build_repo" and "qt_add_qml_module". Rather than investing a lot of time to support building TreeView with cmake and Qt 5, just inform that we only support building it with qmake for that version. Change-Id: Iae1a91de5e6cb10bb518ee21f9bcccdbff6c8561 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Add CMake port based on the qmake setupVenugopal Shivashankar2021-01-079-0/+225
| | | | | Change-Id: I47e7972bd2853608239a831586ba304573a7aef5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Update dependenciesVenugopal Shivashankar2021-01-071-3/+2
| | | | | Change-Id: I8dae2b8e1d0b2c063d1d4fb0f0b39af83573e715 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Fix documentation warningsTopi Reinio2020-11-262-78/+69
| | | | | Change-Id: Ic7a9e19c9cc6acc5d43965d51c2296bff6d7db3a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add dependencies.yamlRichard Moe Gustavsen2020-10-221-0/+8
| | | | | Change-Id: Id857e8584ce782e1438270e963788cbadf2e5c43 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Update correct marketplace license headerJani Heikkinen2020-10-2213-104/+143
| | | | | | | | | Use header.GPL3-MARKETPLACE-QT which must be used in marketplace components Change-Id: Idf5bb061b0724f4bc0f691586eb74e839fe0ad37 Reviewed-by: Tino Pyssysalo <tino.pyssysalo@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add marketplace license fileJani Heikkinen2020-10-221-0/+716
| | | | | | | Change-Id: I722f4d534bd058d4358a84f9e5dd36c322f4a123 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tino Pyssysalo <tino.pyssysalo@qt.io> Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Update license headers to use the Marketplace version (2)Richard Moe Gustavsen2020-07-162-2/+2
| | | | | | | | | | | Update the license headers of the source files (excluding examples and tests) to use the Marketplace version. The first patch was missing two files. This patch will update those as well. Change-Id: I73f6689bc739e06d5c48d7e4a8f444954fc6469f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Update license headers to use the Marketplace versionRichard Moe Gustavsen2020-07-155-5/+5
| | | | | | | | | | Update the license headers of the source files (excluding examples and tests) to use the Marketplace version. Fixes: QTBUG-85354 Change-Id: Ic06e8300f2744bd71a3294c506d9b2e6259f499d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add missing lines to license headersRichard Moe Gustavsen2020-06-0313-0/+26
| | | | | Change-Id: Ic2e24da36e72c94aa3192aabd10858e3a79658ef Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Disable some examples when widgets are not availableRichard Moe Gustavsen2020-06-022-0/+4
| | | | | | | Some examples uses QFileSystemModel, which is a part of widgets. Change-Id: Id52940410273dfdeceaf027aa9fa71da8e8606ba Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Doc: Fix the qhp file name in the qdocconfVenugopal Shivashankar2020-05-281-1/+1
| | | | | | | | Qdoc by default assumes the qhp filename is same as the qhp.projects name in lower case. Change-Id: Ic7ffef901352fdc46afe94316c23989c061015b9 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Fix auto-test not buildingRichard Moe Gustavsen2020-05-201-1/+1
| | | | | Change-Id: Iabef91ca8404e33b8b3818e98cfa1d9ff5f175e9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make TreeView a proper Qt moduleRichard Moe Gustavsen2020-05-2022-19/+127
| | | | | Change-Id: I1f7214bf6ea9ce6e006ed30f7ee7bf36d3de3e39 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix namespace buildRichard Moe Gustavsen2020-05-151-0/+2
| | | | | | | Add missing QT_END_NAMESPACE Change-Id: Ife419dc5a28436ab3585084bdb6635a0973ad92c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* TreeView 1.0Richard Moe Gustavsen2020-05-1424-0/+3688
Change-Id: Id45430e88f4e34117ccb727537c697f356f25c37