aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* QQuickTableView: Port to new finalizer infrastructureFabian Kosmale2021-09-291-33/+19
| | | | | | | | Task-number: QTBUG-96054 Change-Id: I80e14759b87ab98f1260f6c64c26adff5684e8c9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickTableView: issue warning if no selection model is availableRichard Moe Gustavsen2021-08-261-2/+10
| | | | | | | | | | Print a meaningful warning if the application creates a SelectionRectangle, but forgets to assign a SelectionModel to TableView. Pick-to: 6.2 Change-Id: Icdc438f616a58827425cf842c32ba588c406503b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* doc: update the selection model snippetRichard Moe Gustavsen2021-06-101-3/+6
| | | | | | | | | Fix up some minor issues in the documentation of selection support in TableView. Pick-to: 6.2 Change-Id: Ica2c0014f4e7f960332c283c1ff83a6b0bdd7df2 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Selection support: make TableView selectableRichard Moe Gustavsen2021-06-031-0/+249
| | | | | | | | | | | Let QQuickTableView implement the QQuickSelectable interface. The functions implemented from the interface will be used by a SelectionRectangle in Controls to enable selecting cells in the table visually using pointer drag and selection handles. Change-Id: I6e87ffdc63a97a9dd83b8279fa08762772ce4e03 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Selection support: support setting a QItemSelectionModel on TableViewRichard Moe Gustavsen2021-06-021-5/+153
| | | | | | | | | | | | | | | | | | | | Add support for assigning a QItemSelectionModel to TableView. By doing so, delegate items that has a "required property selected" defined will get this updated according to the state of the selection model. It's essential that the property is defined as "required". If not, the property will simply be ignored by TableView. This is done to ensure that existing applications that already has a "selected" property defined, will continue to work as before, unaffected by the new selection API. [ChangeLog][QtQuick] TableView now supports selections by using an ItemSelectionModel. Task-number: QTBUG-74750 Change-Id: I4f4d75e9e65563b9aab0c54f3aa4aad2f6883952 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* qquicktableview: upon forceLayout(), check for visible rows/columns at the ↵Richard Moe Gustavsen2021-05-061-30/+48
| | | | | | | | | | | | | | | | | | | | | origin There is a bug in TableView which will stop the user from scrolling/flicking back to the first column if it has become visible after first being hidden. The reason is that this is somewhat of a special case that happens only if the current left column is already at the origin of the viewport, since that will fool tableview into thinking that there can be no more columns in front of it. This patch add an extra section to the function that checks for visibility changes, to detect this special case. Fixes: QTBUG-93264 Pick-to: 6.1 5.15 Change-Id: Ieaad507b45ea11dc231519e9f49cbf182d6443ba Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* docs, qquicktableview: document correct return valueRichard Moe Gustavsen2021-05-031-2/+2
| | | | | | | | isColumnLoaded and isRowLoaded both return bool values, and not Item (which is copy / paste bug) Change-Id: I746e4c61fcfb67f42f115ff903963277adc9eab1 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Fix qdoc warnings from wrong linking attemptsVolker Hilsheimer2021-04-191-7/+7
| | | | | | | | Document parameters with \a, and link to other members correctly. Pick-to: 6.1 Change-Id: I3529aa96fff0e5b78faa7438f40dc217de7b6262 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickTableView: add API to get column widths and row heightsRichard Moe Gustavsen2021-04-131-0/+106
| | | | | | | | | | | | | | | | | | Add a set of functions that can be used to query both the actual row and column sizes, but also what the implicit sizes are. The implicit size of a column is defined as the maximum implicit width found among the items in that column. This implicit size is just a recommendation that can be used by e.g HeaderView to resize a column to perfectly fit the contents. [ChangeLog][QtQuick][TableView] Added API to query row heights and column widths: columnWidth(col), rowHeight(row), implicitColumnWidth(col), implicitRowHeight(row). Fixes: QTBUG-92124 Change-Id: Id8adbd558dab670d4d1c0bb268105b56b898b72a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: add isColumnLoaded() and isRowLoaded()Richard Moe Gustavsen2021-04-131-2/+82
| | | | | | | | | | | | | | | | | | | | TableView needs an API that lets you check if the delegate items inside a row or column is available for iteration from within the columnWidth/rowHeightProvider. This is especially needed since we call the providers several times when loading a new row or column - once to figure out if it's visible, and another time later, to get the width to use for layout when the items are loaded. [ChangeLog][QtQuick][TableView] Added API to query if a row or column is loaded and available for iteration: isRowLoaded(row) and isColumnLoaded(column). Fixes: QTBUG-92151 Change-Id: Iad0c9953a794bb6464b973f79e18826b4727fb47 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: always update content size when rebuilding small tablesRichard Moe Gustavsen2021-03-261-2/+24
| | | | | | | | | | | | | | | | | | | | If you have a TableView with only a couple of rows, and you add a third one, the contentHeight doesn't update. This is fine if not all rows are loaded (some are outside the viewport), but when they are all inside, it should update to reflect the exact height. The same is also the case for the contentWidth. If you add a new row that increases the with of a column (and all columns are visible), the contentWidth should update. This patch adds an extra check when we do a rebuild (which we do when you add a new row), to see if all rows or columns are loaded. And if that is the case, we update contentHeight or contentWidth, respecitively. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-92099 Change-Id: I806bfb7c3606fca97c5d27cbb91856cc40df9fb8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: make functions constRichard Moe Gustavsen2021-03-261-4/+4
| | | | | | | | | Some functions are just getters, and should be const. This change will make it easier for subclasses like TreeView (and HeaderView) to access them. Change-Id: Ia9093814e065c581fabdc74a51a6e528d103723c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: forceLayout() should work, even when no items are loadedRichard Moe Gustavsen2021-03-231-3/+9
| | | | | | | | | | | | | | | | | As it stood, we would return early from forceLayout if no items were loaded. This made sense, since when no items are loaded, there would be no items to lay out. But after we changed the logic so that an application can show or hide rows and columns by returning an empty size from the size providers, we now always need to do a layout to check if some rows or columns should become visible. Pick-to: 5.15 6.0 6.1 Fixes: QTBUG-92076 Change-Id: I2a07bf8e62cfeebcbe36c01aa92eca3ed8227cd3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Move event delivery from QQWindow to QQuickDeliveryAgentShawn Rutledge2021-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | QQuickWindow owns QQuickRootItem which owns QQuickDeliveryAgent, so for every window there's an object responsible for event delivery, while the window itself is mainly responsible for rendering (separation of concerns). However, QQuickRootItem and QQuickDeliveryAgent can now be used in cases where the scene doesn't directly belong to a window, such as when a Qt Quick sub-scene is mapped somewhere into a Qt Quick 3D scene. In that case, we must remember which delivery agent was in use at the time when a QEventPoint is grabbed and deliver subsequent updates via the same DA. There's also a QQuickDeliveryAgent::Transform abstraction which subscene-management code (such as QQuick3DViewport) can implement, to provide a formula to map the window's scene coordinates to subscene coordinates; if defined, it will be used during delivery of subsequent updates to existing grabbers. Task-number: QTBUG-84870 Change-Id: I70b433f7ebb05d2e60214ff3192e05da0aa84a42 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Show a tableview even if the syncView has an empty modelAndy Shaw2020-12-091-5/+2
| | | | | | | | | | By showing the tableview, we can be sure that headerviews will be visible even in the syncView has an empty model. Fixes: QTBUG-87526 Change-Id: I68c8b119122a2d2f88c2afbeb2d6c71a83a3ce33 Pick-to: 5.15 6.0 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2020-11-051-29/+26
| | | | | | | | | | | - Remove links to modules and examples that are not part of Qt 6. - Remove links to entities marked as \internal - Add missing enum value and QML property docs where it's trivial to do so. Task-number: QTBUG-88156 Change-Id: I10a1c7bcc5fe0e2354ea69eaf24930362edb7415 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* TableView: ensure we rebuild the sync view, even when flicking on a sync ↵Richard Moe Gustavsen2020-10-231-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | view child When two table views are connect through the syncView property, both views will flick when you flick on either of them. This also means that if you fast-flick more than a page on the sync view child, the sync view needs to rebuild, like if you did the fast-flick directly on the sync view. Because we updated the sync view's viewportRect too soon while fast-flicking on the the sync child, we didn't detect that it was a fast-flick, and that a rebuild was needed. The result is that you could sometimes end up with the views getting out-of-sync. This patch will allow TableView to only move the viewport without updating the internal viewportRect while flicking. The viewportRect will instead be sync-ed at a later point, like we do when you flick on the sync view directly. This will ensure that we rebuild if needed, also while fast-flicking on the child view. Task-number: QTBUG-87821 Pick-to: 5.15 Change-Id: Ifc74473eb43406acaa8e24880066fb4ca89d3a4e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* TableView: ensure we update content size upon model changesRichard Moe Gustavsen2020-10-211-28/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For tables of non-trivial sizes, we usually don't know what the content size will be unless we load all rows and columns, which we simply cannot do. Because of this, we have up till now chosen a strategy where we normally just calculate a predicted content size up-front, when we table is built, and afterwards just stick to that prediction. This strategy works for big tables that fills more than one size of the viewport, and if the number of rows and column in the model stays around the same. But for tables that start off smaller than the viewport, and later expands to grow out of it, it simply fails. And the failure is such that the tableview can get stuck, with no way way for the user to flick around to see the rest of the contents. An example is TreeView that might only show the root node at start-up, but as you start to expand the tree, it will quickly add more rows than what fits inside the viewport. And in that case, the contentHeight will be totally off, and in turn, make the scrollbar be based on wrong values, and sometimes not work at all (e.g if it has the flag Flickable::StopAtBounds). This patch will change the implementation so that we recalculate the content size whenever it should logially change. That is, if e.g the model add or remove rows and columns, or if you change spacing. This still doesn't mean that contentWidth/Height reports the correct size of the table, but at least it will be a better guestimate for smaller tables, and at the same time, work together with Flickable and ScrollBars. Pick-to: 5.15 Fixes: QTBUG-87680 Change-Id: Ie2d2e7c1f1519dc7a5d5269a6d25e34cf441b3fe Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Fix qdoc warningsPaul Wicking2020-09-111-2/+2
| | | | | | | | | | * Use correct qdoc markup commands. * Add replacement snippet to make up for snippet file removal in a7a88483c61150f7b7d78dc97f4a521ef9f04899. * Correct file name capitalization in snippet. Change-Id: I1fe30834292f8536c97b2bc4df0a654649431675 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Fix minor typosSze Howe Koh2020-08-301-1/+1
| | | | | | Pick-to: 5.15 Change-Id: I4c51c40697e410d56b6a2d2446ed9f8ae218576d Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* TableView: during layout, set item width before heightRichard Moe Gustavsen2020-05-081-9/+22
| | | | | | | | | | | | | | | | Text items like TextEdit will calculate their implicit height based on the assigned width (because of word-wrap). It's therefore better to set the width of delegate items first during a layout than after, since then we also get the correct height in such (special) cases. The result is that a rows height will show all the text in a TextEdit, and not clip it. Pick-to: 5.14 5.15 Task-number: QTBUG-84046 Change-Id: I1893187027b45649568347ffc3ed5d4d84beaa95 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* TableView: allow negative spacingRichard Moe Gustavsen2020-05-071-2/+2
| | | | | | | | | | | There is no apparent reason why negative spacing should not be allowed. And in fact, you can use negative spacing to eliminate double edges in the grid when the delegate is e.g a rectangle with a border. Fixes: QTBUG-83956 Pick-to: 5.15 Change-Id: I3be9d58ac8c43142e26e75165274e41872e878f4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickItem: rename geometryChanged to geometryChangeMitch Curtis2020-04-231-2/+2
| | | | | | | | | | | | | | | | | | This brings it in line with the existing convention in this and other modules, where virtual handlers are named "nounChange"; e.g. itemChange. Signals are named "nounChanged". This also allows adding a geometryChanged signal, which would enable users to listen to one signal for all changes to x/y/width/height. [ChangeLog][QQuickItem] Renamed geometryChanged to geometryChange in order to follow existing naming conventions and have consistency with existing API, such as itemChange. Task-number: QTBUG-82994 Change-Id: I0547358c796a0047982ccfbf2c38bab952e7a634 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTableView: redirect all positioning functions to positionViewAtCellRichard Moe Gustavsen2020-04-141-91/+61
| | | | | | | | | | Refactor both horizontal and vertical positioning into positionViewAtCell, and let the other functions just forward the call to it. Update the docs to inform about this, and include the same warning as found in ListView's positionViewAtIndex. Change-Id: I8143df7f8efb78d7dbecdcfca95cf3e5fc078b86 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTableView: add functions to get current rows and columnsRichard Moe Gustavsen2020-04-091-8/+114
| | | | | | | | | | | | This API can be used to query and iterate the currently loaded rows and columns inside the view. [ChangeLog][QtQuick][TableView] Added the properties leftColumn, rightColumn, topRow, and bottomRow, which can be used to query which part of the model is currently visible inside the view. Change-Id: I06f99cc1e8da1004dc8614977f149192e1880ba4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTableView: add cellAtPos() functionsRichard Moe Gustavsen2020-04-091-0/+76
| | | | | | | | [ChangeLog][QtQuick][TableView] cellAtPos(x, y) has been added to query which cell is under the given position. Change-Id: I69523868158b589ea3bb9facba815000d2a058d7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-091-6/+13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4executablecompilationunit.cpp src/qml/jsruntime/qv4executablecompilationunit_p.h src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlpropertycachecreator_p.h src/qml/qml/qqmltypecompiler.cpp src/qml/qml/qqmltypedata.cpp tests/auto/qml/qmlformat/tst_qmlformat.cpp tools/qmllint/scopetree.cpp src/qml/qml/qqmlapplicationengine_p.h Adjusted tools/qmllint/findunqualified.cpp to use newer API Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
| * QQuickTableView: fix crash in tableLayoutToString()Richard Moe Gustavsen2020-04-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | The function QQuickTableViewPrivate::tableLayoutToString() returns a string used for debugging the loaded table. If the table is empty, it will crash/assert while trying to read data out of an empty vector. This patch will check for this case before creating the string. Change-Id: I47c01b3c8447ccc7424fe475f38e22ff70c681d8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * TableView: Clarify the rows/columns docs about inserting/removingAndy Shaw2020-04-031-6/+11
| | | | | | | | | | | | | | Fixes: QTBUG-82904 Change-Id: Ib44122fd0c2e5fc83cfef1368ed4ec0f3b1951af Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickTableView: add function: itemAtCell(const QPoint)Richard Moe Gustavsen2020-04-081-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | Add a function to the API to let the application get the item loaded for a specific cell. [ChangeLog][TableView] A function 'itemAtCell()' has now been added to let the application get the delegate item loaded for a specific cell. Change-Id: Ie84ef44ea2a0a901487812c4d611b98d4c86ee22 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QQuickTableView: add positionViewAtRow()/Column()Richard Moe Gustavsen2020-04-081-14/+307
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add functions to let the application scroll the table to a specific row or column using a specific mode. This API partially mirrors the API found in ListView. [ChangeLog][QtQuick][TableView] positionViewAtCell(), positionViewAtRow(), and positionViewAtColumn() have been added to enable the application to position the contents to show a specific cell. Fixes: QTBUG-83215 Change-Id: I321588041977f9ded40f84fc0499ea1c5f6ac801 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-241-13/+28
|\| | | | | | | Change-Id: I9f0d5adf1ba7d3246b1107a20d145e7aac2c7a77
| * QQuickTableView: add private support for transposing the viewRichard Moe Gustavsen2020-03-231-13/+28
| | | | | | | | | | | | | | | | This is needed by HorizontalHeaderView when assigning it one dimensional models. Change-Id: I183f0d35b8f3a97853fc7496dc68b0e13e9be990 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-091-2/+11
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmlirbuilder_p.h src/qml/qml/qqmlpropertycachecreator_p.h src/qmltyperegistrar/qmltypesclassdescription.cpp src/qmltyperegistrar/qmltypesclassdescription.h src/qmltyperegistrar/qmltypescreator.cpp src/quick/items/qquicktext_p.h src/quick/util/qquickvaluetypes_p.h Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-03-031-1/+10
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qmlmodels/qqmltableinstancemodel.cpp src/qmlmodels/qqmltableinstancemodel_p.h Change-Id: I89339b1cb41ba27fe30c79530859a1c2bfbecc69
| | * QQuickTableView: Immediately delete delegates when possibleUlf Hermann2020-02-281-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the dtor we don't need to care about any side effects a direct delete may have. Rather, any deleteLater() may not take effect anymore as the event loop may be gone already. Task-number: QTBUG-82000 Change-Id: I97935dc47fbbfd0c050e80c333c36a05f685c45d Reviewed-by: Joni Poikelin <joni.poikelin@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Doc: Fix QQuickTableView snippetUlf Hermann2020-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Use static registration, provide a .pro file, and make it load and show the right file. Change-Id: I949831a399ce00cd8b3d012d8bd4e95a1efcdeb5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-171-13/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/qtqml/plugin.cpp src/qml/qml/qqml.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypeloader.cpp src/qml/types/qqmlbind.cpp src/quick/items/qquickitemsmodule.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I52548938a582cb6510271ed4bc3a9aa0c3c11df6
| * | QQmlInstanceModel: refactor recycling signals to base classRichard Moe Gustavsen2020-02-051-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that QQmlDelegateModel has an API that handles reusing delegate items (*), we should also move the related signals inside it to be consistent. This will also remove the need to cast the model type in the views before connecting. This patch will also remove warnings that stems from QQuickListView trying to connect to the reuse signals when the model is not a QQmlDelegateModel. *: E.g: virtual ReleaseFlags release(QObject *object, ReusableFlag reusableFlag = NotReusable) = 0; Fixes: QTBUG-81257 Change-Id: Ia8a8f0d68e6ef7edc6c45b414121aaa77632bcd3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-211-8/+17
|\| | | | | | | | | | | Change-Id: Ic2cea85917751b89c34768fd80d8b11f5706dd62
| * | QQuickTableView: make syncView/syncDirection/model private implementation ↵Yulong Bai2020-01-201-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual For usage in HeaderView, moving getters/setters/sych-ers in private implementation virtual, keep public APIs clean and also make private implementations overridable. Change-Id: I4ad04665b7268354a49dc9711944ee0c6fd2738f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | Use QFlatMap in QQuickTableViewShawn Rutledge2020-01-151-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFlatMap is implemented to use two containers internally, one for keys and one for values. This improves locality of reference for the purpose of doing binary search to find a key quickly, and also makes the keys() (and values()) accessor really fast. Change-Id: I87bbb06371aeb44c5bcf971d72ae9cd59920f800 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-141-5/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/folderlistmodel/plugin.cpp src/imports/layouts/plugin.cpp src/imports/localstorage/plugin.cpp src/imports/models/plugin.cpp src/imports/particles/plugin.cpp src/imports/qtqml/plugin.cpp src/imports/qtquick2/plugin.cpp src/imports/shapes/plugin.cpp src/imports/statemachine/plugin.cpp src/imports/testlib/main.cpp src/imports/wavefrontmesh/plugin.cpp src/imports/window/plugin.cpp src/imports/workerscript/plugin.cpp src/qml/jsruntime/qv4sequenceobject.cpp src/qml/qml/qqmlengine.cpp src/qmlmodels/qqmlmodelsmodule.cpp src/qmlmodels/qqmlmodelsmodule_p.h src/qmlworkerscript/qqmlworkerscriptmodule.cpp src/qmlworkerscript/qqmlworkerscriptmodule_p.h src/quick/items/qquickitemsmodule.cpp Change-Id: I5f1fbc3d00e8f583d2c89afc5389de84d68633a7
| * | QQuickTableView: reuse items also when using QQmlInstanceModelRichard Moe Gustavsen2019-12-191-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that QQmlInstanceModel has an API that supports delegate recycling, remove the special case from TableView. What this means in practice is that a TableView can now also reuse items when the model assigned is a DelegateModel. The recycling API in QQuickInstanceModel is already tested by the QQuickListView test. Change-Id: I08c9fe2ce230c2b41b40fe97efdfca78eb5dd296 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Fix crash in tst_qquicktableviewSimon Hausmann2020-01-131-1/+2
|/ / | | | | | | | | | | | | | | | | Avoid a range-for over a list that's sometimes modified during the iteration. Change-Id: I4888ace4ebb86bfaa9f92d7e6272114c0af01421 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-101-13/+34
|\| | | | | | | Change-Id: Iadbdd0fb63ca2a9e0b186343f8b730e4114cd71b
| * QQuickTableView: set empty content size when table is emptyRichard Moe Gustavsen2019-12-091-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | From before we would bail out early from the rebuild process if we detected an empty table. A result from this is that we left both contentWidth and contentHeight unchanged. This patch will set an empty content size when the table is empty. The effect will be that the user cannot flick the view around based on the old size. Fixes: QTBUG-80505 Change-Id: I3ac080476269fd5906ce79fa007eabb59b5ff4b1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * QQuickTableView: ensure we release items in the old model and not the newRichard Moe Gustavsen2019-12-091-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As it stood, we would wait to release loaded items until we started the rebuild process, if the old model was a DelegateModel. But at that time, the model would alread have been changed, so we would release the items by calling out to the wrong model. This patch will ensure that we always release the items immediately when syncing the model, which will also cover the case when the model is a DelegateModel. Fixes: QTBUG-80570 Change-Id: I1b06011f4795727d04d9cd8c20381f65552b8fe8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * QQuickTableView: support assigning a DelegateModelRichard Moe Gustavsen2019-12-091-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally you either assign a model to TableView that already has a delegate (or don't need one), like DelegateModel or ObjectModel. Or instead you assign a QAIM model and a delegate directly. But if you assign both a delegate and an ObjectModel, TableView would be confused, and ignore the assigned model and instead create an internal wrapper model that ends up empty. This patch will ensure that we don't create a wrapper model in such cases, but instead forward the delegate to whichever model is assigned, even if it ends up as a no-op for models that don't use one. Task-number: QTBUG-80534 Change-Id: Idd220df08617c379dc7808ee1f41c862b78cc201 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>