summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels
Commit message (Collapse)AuthorAgeFilesLines
* QAbstractProxyModel: Document setSourceModel a bit moreDavid Faure2012-12-201-0/+4
| | | | | | | Especially so that subclasses remember to emit reset. Change-Id: Iadcae3fc5fe72584465d4134f385ed0a1d77bfcd Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Docs: Fix referencesChristian Stenger2012-12-132-3/+3
| | | | | Change-Id: I48173186afb874d307010f4f303d0e4f97ec0287 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Add more qtbase implictly-shared classes to the listGiuseppe D'Angelo2012-11-301-0/+1
| | | | | | | QText*Format and QDns* ones are still missing. Change-Id: I8e87fba596e87289ca935717e0a90bfc0b0a26c0 Reviewed-by: hjk <qthjk@ovi.com>
* QtCore: Make more signals private.Stephen Kelly2012-11-282-2/+6
| | | | | | Change-Id: Ida190e8b9c1ff47a6f54a5bf68673ab50a2f1bfe Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QAbstractProxyModel: fix sibling() reimplementationMark Brand2012-11-081-1/+1
| | | | | | | | | | | The previously missing mapFromSource() sets the proxy model in the returned index. Otherwise, the returned index refers incorrectly to the source model. Follow-up to 9dfba89c28bbff3316cb7aed6c07f90c0f2d5a22 and e5ac4fb9b236c782e3ed6f15044eb9956246931a Change-Id: I25cd7baa4a93284ab14ede988ac524971870794e Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Remove qSort/qStableSort usages from itemmodelsGiuseppe D'Angelo2012-11-073-12/+18
| | | | | Change-Id: I53c650f170fc8a6142373c1e7da0f4876188a39e Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QIdentityProxyModel: fix sibling() reimplementationMark Brand2012-11-021-1/+1
| | | | | | | | | | | The previously missing mapFromSource() sets the proxy model in the returned index. Otherwise, the returned index refers incorrectly to the source model. Follow-up to 9dfba89c28bbff3316cb7aed6c07f90c0f2d5a22. Change-Id: I78ab9183820909b646a7333f28aa5ec7266fa675 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add implementations of QAIM::sibling in public APIs.Stephen Kelly2012-11-029-0/+50
| | | | | | Change-Id: I2248641f2ed8735c28bd9572470520995a4a5b62 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Strip trailing whitespace in itemviews.Stephen Kelly2012-11-011-1/+1
| | | | | | | | | | | Using git ls-files -z | xargs -0 sed -i 's/ \+$//' in the relevant directories. Change-Id: I861ef9952fb32ed2db9ec8b67864ec7d0d61f0f2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use the layout change hint to speed up QItemSelectionModel.Stephen Kelly2012-10-223-28/+110
| | | | | | | | | | | The testcase in the bug report takes 370035 ms to sort the rows with Qt 4, and 5646 ms in Qt 5 (when using the extra hints to layout*Changed). That's an improvement of more than 98%. Task-number: QTBUG-17732 Change-Id: If78f972d80c501e0cb39078228086c4f4ac8a65b Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Handle the case where persistent indexes have gone invalid.Stephen Kelly2012-10-191-0/+6
| | | | | | | | | | | | | | | | | | | Don't add invalid ranges to the result. They will be removed whenever d->ranges is processed for public consumption anyway. For example, QItemSelectionModel::selection() calls merge() with another selection. The merge() method removes invalid ranges already. But the invalid ranges don't need to be there in the first place, so this patch removes them. A longer-term goal is to maintain d->ranges as an always-sorted list. This method can be called with a vector containing invalid QPersistentModelIndexes when those persistent indexes are made invalid in between layoutAboutToBeChanged and layoutChanged. It's a normal thing to happen and a case that should be handled deliberately. Change-Id: I741ed9208d8a75644975c9e8d61f0d6d78e20576 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add docs to clarify and restrict what the LayoutChangeHint means.Stephen Kelly2012-10-051-0/+4
| | | | | Change-Id: I1b786c5151bcce253b6afa1eebc85e864ed7e91f Reviewed-by: David Faure <david.faure@kdab.com>
* Forward the layout change hint through QSortFilterProxyModel.Stephen Kelly2012-10-022-20/+20
| | | | | Change-Id: Ic9ae7f011f63c4a53fec4d9425ac6cd6776153ee Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Return QPersistentModelIndexes from QItemSelectionRange.Stephen Kelly2012-10-011-2/+2
| | | | | | | | | They are stored as such anyway, and this allows clients to not have to convert between QModelIndex and back so much. This should be fully source-compatible. Change-Id: Ia606ea082442089a0aae1583380c3710ce61d3d1 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Emit layout change hint from QStringListModel.Stephen Kelly2012-09-301-2/+2
| | | | | Change-Id: I8b4a01cfcca59103f2616b72645994a22bff40dd Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Process and forward the layout change hint through the QIdentityProxyModel.Stephen Kelly2012-09-302-16/+40
| | | | | Change-Id: I074c75080b7e74c44fc833c207d297723e5f6e06 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add hint API to QAIM::layout*Change signals.Stephen Kelly2012-09-292-7/+29
| | | | | | | | | | | | Usually layoutChange is used for sorting elements. The parents parameter to the signal already hints at a localization of what is being sorted, if it's just one level in the tree. The new hints enum can be used to only consider how the first column of a table gets sorted, because all other columns will be sorted the same way. Change-Id: I65dd2996894bbdb45a2f6288edbeaa49e4053256 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Take a QPersistentIndex out of the container instead of casting it.Stephen Kelly2012-09-271-7/+17
| | | | | | | | | | | | These indexes are later used as the boundary points of a QItemSelectionRange anyway, which means that they're going to become QPersistentModelIndexes again soon. Because QPersistentModelIndex::row and ::column API are not inline, we cache the resulting values in the loop. Change-Id: Ib5099148269a8ccbb7ff2d8819a347e429c55dd1 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Use a QVector to store QPersistentModelIndexes.Stephen Kelly2012-09-272-5/+5
| | | | | | | | | QPersistentModelIndex is not so big that it causes very bad QList performance, but considering how we use the container, QVector is fine. We never prepend to the container, we only ever append, clear and iterate over it. Change-Id: If1e53db9252c22340f1e0179b14a460495b5b35d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Avoid looping over the indexes multiple times to create a persistent list.Stephen Kelly2012-09-271-9/+14
| | | | | | Change-Id: I089d272254eb531cd27c7b23fbab4d7183ba01d4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Use the sibling method to make iteration over a range potentially faster.Stephen Kelly2012-09-271-4/+7
| | | | | | | | The implementation of QAIM can implement an efficient version of sibling. Task-number: QTBUG-17732 Change-Id: I474dbc11e52b3ccc42e2165bc9336882fab13d03 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Create an invalid QPersistentModelIndex if it will be converted anyway.Stephen Kelly2012-09-271-2/+2
| | | | | Change-Id: I278d4515d74e2213492c443e5a04731b2e79fe1e Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix typo in variable name.Stephen Kelly2012-09-271-2/+2
| | | | | | Change-Id: I3bd59982605d242c95278bfeb71a6071ec222d08 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename a variable it -> childIt.Stephen Kelly2012-09-271-5/+5
| | | | | | | There is another iterator called it at the top of this function. Change-Id: I8addf47d66f098c5d811eb54674525eddb4d4a1f Reviewed-by: David Faure <faure@kde.org>
* Don't call parent() so often when processing a range.Stephen Kelly2012-09-261-1/+2
| | | | | | Task-number: QTBUG-17732 Change-Id: Iefe5801f5941136f77001c532870e22f7fdd2c69 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QModelIndex: add constexprMarc Mutz2012-09-241-10/+10
| | | | | | | | | The functions dealing with the void* internalPointer() can't be constexpr on GCC 4.6 and Clang 3.2-trunk, even though GCC 4.8-trunk accepts it, because of the casts required. Change-Id: Id04105312da3d0c7632f7df06a34bc5a71120b32 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QModelIndex: store quintptr instead of void*Marc Mutz2012-09-241-16/+12
| | | | | | | | | | | | | | | | Rationale: 1. Comparing pointers that don't point the same array is undefined behaviour, IIRC, and op== and op< did that. 2. The functions that cast to/from the storage type can't be constexpr. It makes more sense to have the quintptr functions be constexpr (they have a fighting chance to actually get passed something constant) than it is to have the void* functions constexpr. Thus, the storage type should be quintptr. Also prepare op< to be constexpr-compatible. Change-Id: I4b2d4a0ec8ca80d619d272bf07c57887cbd11c2f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QModelIndex: clean up integer size confusion in the APIMarc Mutz2012-09-222-42/+15
| | | | | | | | | | | | | | | | | | | | | | QAIM::createIndex() took either int or quint32, but QMI::internalId() returned qint64. In the new interface, createIndex() takes, and internalId() provides, integers of type quintptr. This matches the storage size of the void* in the model index and avoids truncation. Remove the createIndex(int, int, quint32) and \obsolete createIndex(int,int,int) overloads. This makes a literal 0 in the third parameter ambiguous now. The solutions have been noted in changes-5.0.0. Change-Id: I0a0ecd8430eaf695129a4d09d14d4e30745485c4 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2215-358/+358
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix crash when invalidating a QSortFilterProxyModelStephen Kelly2012-09-131-9/+19
| | | | | | | Task-number: QTBUG-27122 Change-Id: Ibca46b88442f4f92422d9b3182e4bbf25716a07f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* doc: Clean up QAbstractItemModel documentationEskil Abrahamsen Blomfeldt2012-09-071-5/+7
| | | | | | | | Mention QML as an alternative to widgets in the documentation, and fix a typo Change-Id: Ia6aaef9ec73d5112ff45c22b0bf57f1f9c7d31a3 Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
* fix docsFrederik Gladhorn2012-09-032-3/+3
| | | | | | Change-Id: Id57b7932afb89fe9d3f4f6e6c3b558265475d77b Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Make QAbstractItemModel::sibling virtual.Stephen Kelly2012-08-232-17/+21
| | | | | | | | | | | | | | | | | | | This would allow implementations to create an optimized way to create sibling indexes. A typical pattern of QAIM implementation is to use the same internalPointer for each row of a subtable of a model (such that the internalPointer is related to the common parent of each set of rows) and differentiate on the row value in the QModelIndex. Alternatively, it is also common to have the internalPointer correspond directly to the row value for the QModelIndex. In both cases it is possible for the implementation to optimally create a sibling QModelIndex in the same column as a known row. Provide a virtual method for them to do so. Change-Id: I3b076abcd5f6087a4cb108fbc6dceeef15529987 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-235-6/+11
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Doc: Fix snippet and example referencing widget examplesAndy Nichols2012-08-232-3/+3
| | | | | | | | Widget examples were moved into a widgets subfolder, but qdoc references were not updated. Change-Id: Id2a4573e723745b9827c664c852807d6116f8f6d Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Optimize QAbstractItemModel::sibling a bit.Stephen Kelly2012-08-221-1/+1
| | | | | | | | QModelIndex::sibling has a simliar optimization. Change-Id: Ic0717d480ba0d46a4c0c88064bc9eda4c4ffe6f6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Fix the doc errors in itemmodels and itemviews.Stephen Kelly2012-08-203-3/+51
| | | | | | | | | Other errors remain, but they appear to be due to missing links to QtCore documentation (a generic error not specific to itemviews). Change-Id: I7b83380c3754c26d3d42be9ef0c0721ce3127562 Reviewed-by: Shawn Rutledge <shawn.rutledge@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Remove QProxyModel from qtbase.Stephen Kelly2012-08-201-1/+0
| | | | | | | A copy is placed in uihelpers for anyone who might be using it. Change-Id: I175f7bc5dcbf25a910d28bfd8985579866392938 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix a couple of qdoc errorsLars Knoll2012-08-181-13/+0
| | | | | Change-Id: I79f689e08ed4a496052529af38fca72c3d4e04cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Only emit headerDataChanged for valid proxy intervals.Stephen Kelly2012-08-151-7/+35
| | | | | | | | | | Modeltest asserts before the patch, and passes afterward. Task-number: QTBUG-26515 Change-Id: I08a89cd5c9c59613badcddbd056a3d0b8fbbca13 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Make the "\internal" qdoc command stand on its own lineLaszlo Papp2012-08-151-1/+2
| | | | | | | | | | The qdoc manual currently claims that the command must stand on its own line. The change follows the consistency with the rest and how the example looks like inside the qdoc manual for this command. Change-Id: I6b653dc95cf9d84e4adf32220dace5d313678419 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QModelIndex: remove user-defined copy operationsMarc Mutz2012-08-111-3/+1
| | | | | | | | | | | | They're identical to the ones the compiler will synthesize and their presence prevents move constructor and assignment operators from being synthesized alongside their copy counterparts. The destructor can go, too. Change-Id: Ia9cc26ba1ffaa670f03642af457e632f44bd69c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make rowIntersectsSelection take account of the parent argument.Stephen Kelly2012-08-101-4/+7
| | | | | | | Task-number: QTBUG-22370 Change-Id: I497194793eab624b760deea93dac0df767850330 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Avoid crashes when invalidating a proxy model filter.Stephen Kelly2012-08-071-3/+10
| | | | | | Task-number: QTBUG-26107 Change-Id: I2df7ae6402136570c8469d3251edae6ca8290f1f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* More qHash(T, uint) supportGiuseppe D'Angelo2012-07-232-7/+9
| | | | | | | | Add the seed to QPair, QUuid, QPersistentModelIndex's qHash(), and fix qHash documentation for them and for many other datatypes. Change-Id: I1386f3ed42ee1a832371a242ee5c82895ba92c2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* fix "No such ..." documentation errors in QAbstractItemModelJeremy Katz2012-07-191-3/+3
| | | | | Change-Id: Ic1d0761c310c47f95d98988d77aff0f8e46de5fb Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Normalize signal/slots.Sergio Martins2012-07-171-52/+52
| | | | | | Change-Id: I0a0f497ece081a430437adc2959deb247defcde9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Make it possible to use new syntax to connect to model signals.Stephen Kelly2012-07-132-31/+83
| | | | | | | | | The private signals can not be used as function pointers, as required by the new syntax, so we introduce a parameter which can only be created privately. Change-Id: I3d7bb8a163e764d685e8007cba831fb77e3c6855 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QtCore: mark some classes as sharedMarc Mutz2012-07-101-1/+1
| | | | | Change-Id: I811d3eebd87c230883cc579c20f9fa4e14ff9521 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a Q_PROPERTY for the sourceModel of a proxy model.Stephen Kelly2012-07-042-9/+16
| | | | | | | | | | | Now that Q_PROPERTY with a QObject derived type is more powerful. This property can be used in QML so that wrappers for proxy models do not need to be created, such as in the example at https://codereview.qt-project.org/#change,13007 Change-Id: I6ba676549d2135585d429a28e214fef0b2a6b1f9 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>