summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* QtCore: add member-swap to shared classesMarc Mutz2012-07-032-0/+8
| | | | | | | | | | Implemented as in other shared classes (e.g. QPen). Special case: QUrlQuery: document existing swap(). Change-Id: I4b36cc9577fbf2232d4b2a2d8822d26e41e22cad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update the docs about setRoleNames deprecation.Stephen Kelly2012-06-211-0/+2
| | | | | | Change-Id: I5aff626979238014d34cba1d383051cd4b048499 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Use a QVector<int> instead of a QSet<int> in itemviews/models.Stephen Kelly2012-06-122-6/+7
| | | | | | | | | | | | | | The QSet<int> is a more expensive container to use and create, so it should be avoided. This is source incompatible compared to earlier Qt 5 for QAbstractItemView subclasses which reimplement dataChanged, but this patch changes nothing compared to already-present SiC compared to Qt 4. Change-Id: Id95391dfd62a0a7f487a8765790b007badefb937 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Itemviews: compile with QT_STRICT_ITERATORSThiago Macieira2012-05-261-1/+1
| | | | | | | Just a few mixed up iterators. Change-Id: I19f62457ee24bc844fadd182ba61866e259e9636 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-195-39/+41
| | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Document that the order of results from QAIM::match are not relevant.Stephen Kelly2012-04-041-1/+3
| | | | | | | This will allow fixing of QTBUG-10160 in Qt 5.1. Change-Id: I1ea7579cb4227f9940847c62d5a520c7cee3b0c5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Deprecate QItemSelectionModel::intersect().Stephen Kelly2012-04-022-4/+7
| | | | | | | It is already obsolete since the beginning of time (Qt 4.5). Change-Id: Ia2f9d934f0c0bd2038d693a29d1315867a526dfe Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Merge master into api_changesKent Hansen2012-03-161-40/+40
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetatype.cpp src/gui/kernel/qplatformsurface_qpa.cpp tests/auto/corelib/tools/qtimeline/qtimeline.pro Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
| * Disconnect slots from the old sourcemodel in QIdentityProxyModelkb2012-03-141-40/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | When setting a new sourcemodel QIdentityProxyModel::setSourceModel tries to disconnect from signals belonging to the NEW model instead of from the existing sourceModel(). QIdentityProxyModel thus receives signals from both the old model(s) and the new model. This results in ASSERTS triggering in various slots, for example: "Q_ASSERT(topLeft.isValid() ? topLeft.model() == model : true);" in QIdentityProxyModelPrivate::_q_sourceDataChanged. Change-Id: Ic6f65a9ee10981d00206335f2edef78272fadc1a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-03-121-3/+2
|\| | | | | | | | | | | | | Conflicts: tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I884afc3b6d65c6411733a897a1949e19393573a7
| * Fix copy/paste error in QAbstractItemModel::insertRow docu.David Faure2012-03-091-3/+2
| | | | | | | | | | | | | | This method is not virtual. Change-Id: I1c82a63af07d7e78e7a572c0dfcfb2b82122d421 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>