aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmldelegatemodel_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Move model types into their own libraryUlf Hermann2019-05-021-248/+0
| | | | | | | | | | The model types are not part of the core QML runtime and should only be loaded if you explicitly import them. We cannot enforce that in Qt5 as some of them are available from the QtQml import, but we can change it in Qt6. Change-Id: I1e49e84d748e352537ec2d4af901c034c91d038f Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
* Remove QQmlV4HandleUlf Hermann2019-04-101-3/+2
| | | | | | | | This is just an alias for QV4::ReturnedValue. We can as well use the latter. Change-Id: Ibd2c038a3ca726b39a8f0f05e02922adb9fccbdb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlInstanceModel: add variantValue()wip/propertycache-refactorMitch Curtis2019-04-021-1/+1
| | | | | | | | | | | | This is necessary in order to add valueRole API to Qt Quick Controls 2's ComboBox. Make stringValue() non-virtual and have it just call variantValue().toString(). Task-number: QTBUG-73491 Change-Id: Ic4ecf8370eb0bb8045a967bd589e54dfc1ac5263 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Allow DelegateModel-based views to support multiple delegate typesPaolo Angelelli2018-08-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a specific abstract QQmlComponent subclass, QQmlAbstractDelegateComponent, and a default implementation, DelegateChooser, that, together with the type DelegateChoice allows determining the delegate type by role and/or index. The patch also adds QQmlAbstractDelegateComponent support to QQmlTableInstanceModel, that is a simplified version of the delegate model, currently only used in the new table view. DelegateChoosers are intended to behave just like Components in the context of the view. This means that they can be declared outside of the view, and also in separate files, and the same delegate component can be used at the same time in multiple views. [ChangeLog][QtQuick][Item Views] Added a DelegateChooser Component to host DelegateChoice instances to choose different delegates in an Item View (e.g. TableView) depending on model roles. Done-with: Michael Brasser <michael.brasser@live.com> Task-number: QTBUG-26681 Change-Id: Ibe24a31daf9142c8a9ff45ef6c65da0aec8a14dc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQmlDelegateModel: remove rows and columns propertiesRichard Moe Gustavsen2018-07-181-7/+0
| | | | | | | | | | | | | This change reverts 59a9c7c3d9ed. Adding support for rows and columns to a QQmlDelegateModel is no longer needed now that TableView will use QQmlTableInstanceModel. Besides, QQmlDelegateModel was designed from the ground up to only support list models, so just adding those properties was a bit half-baked. Change-Id: I1d58355d98999dc6a2a0b88ea64852c9eb918447 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQmlInstanceModel: add virtual function to get abstractItemModelRichard Moe Gustavsen2018-06-271-0/+2
| | | | | | | | | | | | | | Add a new virtual function to query the model if it's backed by a QAbstractItemModel. This will be needed later when we create another model (QQmlTableInstanceModel) that also inherits QQmlInstanceModel. By having this virtual function, we don't have to check and special case what kind of model is assigned to QQuickTableView, as long as it has a QAIM. Change-Id: I4080fd601ca1988c5fe448d68bdd156740403c60 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQmlDelegateModelAttached: factor out resetCurrentIndex()Richard Moe Gustavsen2018-06-041-0/+1
| | | | | | | | | | When we in subsequent patches start to recycle items, we'll somtimes need to reset m_currentIndex after construction time. This patch will not change any logic, but just move the code that calculates m_currentIndex into a separate function. Change-Id: Ic61825e9cf4b6c0fdb2dfcab1ad9b582ef4413ac Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQmlAdaptorModel: make a models row/column count read-onlyRichard Moe Gustavsen2018-04-121-7/+2
| | | | | | | | | | | | | | This change partly revert 59a9c7c3d9edeb9, since we no longer make use of the introduced API. Being able to override the row/column count for a delegate model was a wrong step. If a view needs to operate on a row/column count that is different from what the model offers, then the mapping should be done in the view (or in a proxy model), and not in the delegate model. Change-Id: I32b0dfa977dd7cae33c399e138aac847e49aa94a Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-03-221-0/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/configure.json src/qml/qml/qqmlengine.cpp src/qml/types/qqmlmodelsmodule.cpp src/qml/types/types.pri Change-Id: I390112f8178c99b36741d3c40901e544c6daafaa
| * Add a feature for DelegateModelUlf Hermann2018-03-211-0/+2
| | | | | | | | | | Change-Id: Ia24767b33a20bd70096bbb8b4f27729c788eb331 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-271-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/parser/qqmljslexer.cpp src/qml/qml/v8/qv8engine.cpp src/qml/util/qqmladaptormodel_p.h src/quick/items/qquickanimatedsprite.cpp tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp Change-Id: I16702b7a0da29c2a332afee47728d6a6ebf4fb3f
| * use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQmlDelegateModel: add support for row and column (revision 2.12)Richard Moe Gustavsen2018-02-091-0/+12
|/ | | | | | | | Add support for setting row and column count directly on QQmlDelegateModel. Change-Id: If171e52764795f98b43753c9524a6740d9c944cf Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQmlDelegateModel: add incubationStatus(), and use it to determine ↵Richard Moe Gustavsen2017-11-301-0/+1
| | | | | | | | | | | | | | 'requestedIndex' We used to assign the currently incubating item to 'requestedIndex' based on requested incubation mode alone. This is not sufficient, as the item can also be loaded async when the mode is AsyncIfNested. To check if the item is really loading async (and that we're not getting nullptr because of some other failure), we need to ask the incubator. Task-number: QTBUG-61537 Change-Id: Id1f458db4a7584a6b58d5bad0e7832ce4fc341dc Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQmlIntanceModel: use QQmlIncubator::IncubationMode instead of bool to ↵Richard Moe Gustavsen2017-11-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | specify incubation mode The current implementation would pass a boolean to signal if asynchronous or synchronous incubation should be used to create an item. The problem with this approach is that passing 'synchronous" would translate to QQmlIncubation::AsynchronousIfNested later down the chain. This meant that even if the caller requested synchronous incubation, it could end up with asynchronous incubation anyway, e.g if an async parent incubator was active at the time of the call. And this can easily come as an unhandled supprise for the caller, and as such, cause unforseen bugs. This patch is a first of a set of patches that is done to fix the bug reported in the task below. It will not change any behavior, it is written to preserve the logic exactly as it were, just as a preparation for subsequent patches. It makes it explicit at the call location what incubation mode will be used, and especially make it clear whenever the AsynchronousIfNested flag is in play. Task-number: QTBUG-61537 Change-Id: I8b3ba5438ebb2cd59983a098bd8ceeeb844da87b Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Qml: add missing 'override'Anton Kudryavtsev2016-10-061-12/+12
| | | | | | | ... and drop redundant 'virtual' Change-Id: I8c0d589557f590eb528e80414d9c002504ccb12a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix performance issues when handling layout changed in Quick item views.Milian Wolff2016-04-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the layout changes, we mark all rows as changed but do not track where the individual rows get moved. The only reason why one would want to track the moves is to persist the current item selection across a layout change. But even the previous code did not achieve that. I'll create a follow up patch to this one that also implements this behavior as seen in Qt Widget item views. Note that removing this code brings a tremendous performance win on larger models. The repeated calls to _q_itemsMoved triggered O(n^2) behavior in the number of top items in the model. Even with "only" tens of thousands of items in the model, a layout change became very costly and took seconds on a beefy modern desktop machine. Calling _q_itemsMoved in a loop is bad because it: - leads to O(N^2) behavior within QQmlChangeSet when merging the small moves into the item view's current change set - potentially triggers tons of binding/property updates when the cached model indices are updated in _q_itemsMoved Removing this slow path, I did not yet find a behavior change to the previous code. Instead, it just does it all much faster. Change-Id: I67fa99a1c5d8e05d17497d29391da9458bd9bdd0 Task-number: QTBUG-51638 Reviewed-by: Daniel Vrátil <daniel.vratil@kdab.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-061-0/+11
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* qml: Pass non-trivially-copyable types by const-refSérgio Martins2015-07-201-1/+1
| | | | | Change-Id: Id3d960ee8236a4c6f4bb4e0add1f88dfa32d3592 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | 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. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Models: Remove QModelIndex metatype re-declarationGabriel de Dietrich2015-01-201-2/+0
| | | | | | | It's absolutely unnecessary. Change-Id: Ib9e4077a8720b7f58886b85c4feabe18205ccb41 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Fix QQmlDelegateModel ignoring layoutChange in certain situationsDan Vrátil2014-06-291-0/+2
| | | | | | | | | | | Fix a regression introduced by commit a0aefe1 which caused the model to ignore layout changes if d->m_adaptorModel.rootIndex was just a descendant of any of the parent indexes, or when no parent indexes at all were provided in the notification. Task-number: QTBUG-39492 Change-Id: I4c97929d25ef75947ccfcbbe5bc234096689c58d Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Implement proper support for layoutChange in QQmlDelegateModelDaniel Vrátil2014-05-121-1/+2
| | | | | | | | | | | | | | | | | | | | | Current implementation is treating model layoutChange the same way as modelReset, which causes problems when using ListView on top of a QSortFilterProxyModel. The model emits layoutChanged whenever a data within sorting column change. Treating it as modelReset leads to poor performance on large models and caused UI issues, because the scrolling position is reset every time. This patch implements proper handling for layoutChanged signals by first handling all items moves and then simulating dataChange for all items. This fixes regression from Qt 5.1 introduced by Change I16b859d9 Task-number: QTBUG-37983 Task-number: QTBUG-34391 Change-Id: I6d3873b7b87e7f0e8fc0c1ed5dc80c6f8fdf6c22 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Michael Zanetti <michael.zanetti@canonical.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Allow QtQuick private headers to be used with QT_NO_KEYWORDS.Jocelyn Turcotte2013-09-121-1/+1
| | | | | | | | | | | This is necessary for the QtWebEngine module. This also adds an empty nokeywords test using the same mechanism as qtbase/tests/auto/tools/moc/no-keywords.h to find conflicts at compile time. Change-Id: I9df541720797dd61f078178c2af68ead18ff8bfe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup v8 dependencies from QQmlV8FunctionLars Knoll2013-05-081-9/+9
| | | | | | | ... and rename it to QQmlV4Function Change-Id: Iad72347babf62691e26306877d4f229fda127eb7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QQmlV8Handle to QQmlV4HandleLars Knoll2013-04-191-2/+2
| | | | | | | | | The handle wraps a V4 Value, so this is the better name for it. Also added some accessor methods to convert to and from V4 Values. Change-Id: I327c83feb5bd3be59909001489979e5a3a9d9e67 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move QML types to types folderAlan Alpert2013-03-141-0/+234
The QtQml module has gain a bunch of QML types cluttering up the qml folder. Moving them to types organizes them a bit better. Change-Id: I570884c00f4abc48f4f1aea048bf002bc70223f3 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>