summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qabstractitemmodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Updated license headersJani Heikkinen2016-01-151-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: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtCore: eradicate all Q_FOREACH loops [itemmodels]Marc Mutz2016-01-041-1/+1
| | | | | | | | Saves more than 4KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Ice3fe915622a399d1ed10e0ce364cf54b4b835fe Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QAbstractModelPrivate: de-inline functionsMarc Mutz2015-12-311-0/+31
| | | | | | | These functions have no business being inline. Change-Id: Ib565fb4870f886be133e9360155bd514935e5e72 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Make use of new QHash::erase(const_iterator) overloadMarc Mutz2015-12-191-11/+11
| | | | | | | | | | Drive-by changes: - use auto for iterators - add Q_UNLIKELY for conditions leading to a qWarning etc Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
* core: Add several QList::reserve() calls.Sérgio Martins2015-06-111-0/+1
| | | | | | | Reduces reallocations. Change-Id: Ib63539fb690a80245d8fe81ff8468e79ffa8e57c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* De-duplicate vtables, part I: exported private classesMarc Mutz2015-06-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | By making the destructor (usually the first non-inline, non-pure, virtual function, and therefore the trigger for most compilers to emit the vtable and type_info structures for the class in that TU) out-of-line, vtables and, more importantly, type_info structures for the class are pinned to a single TU. This prevents false negative dynamic_cast and catch evaluation. In this first batch, we de-inline destructors of exported private classes. Since they are already exported, users of these classes are unaffected by the change, and since it's private API, we don't need to avoid adding code to the out-of-line destructor until Qt 6. Change-Id: I450707877d2cb6a77f79ae1dd355facb98d6c517 Reported-by: Volker Krause <volker.krause@kdab.com> Task-number: QTBUG-45582 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Pass params of shareable type by const-ref rather than by valueKonstantin Ritt2015-02-131-1/+1
| | | | | | | | ...where passing them by value was not intentional. Change-Id: Ifd5036d57b41fddeeacfbd3f5890881605b80647 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-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. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<Kai Koehne2015-02-091-2/+3
| | | | | | | | | Unify the behavior of the different operator<< by always using QDebugStateSaver (appending an optional space at exit), and making sure that the space(), nospace() setting isn't 'leaked'. Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QAbstractTableModel/QAbstractListModel: reimplement sibling()Marc Mutz2015-02-051-0/+16
| | | | | | | | | | | | | | | | | | | | This basically inlines the call to parent(), which unconditionally returns QModelIndex(). The change is binary compatible, because even though we newly override a previously non-overridden virtual method, it doesn't matter whether old code still calls the base class' method, as the new implementation is semantically equivalent, at least if subclasses don't inherit parent() (but why would they). [ChangeLog][QtCore][Important Behavior Changes] QAbstractTableModel and QAbstractListModel now reimplement sibling() to avoid calling parent() (which returns a constant). Subclasses of these models that override parent(), will likely also need to override sibling() now. Change-Id: I9e0cb5622a6d3826e40acaf0e0cd3fdea85cba2d Reviewed-by: David Faure <david.faure@kdab.com>
* Remove Q_NO_USING_KEYWORDThiago Macieira2014-12-201-5/+0
| | | | | | | | | | | | | | | | | | | There's a lot of code now requiring it. Any compiler that doesn't support the keyword is too old for Qt now. The last time anyone asked about this macro was for QTBUG-27393 and we don't know which compiler that was. As a necessity, this patch contains a reversal of a0c3a57aed5cde37017733e7cf5e41cc6a1174aa [ChangeLog][Compiler Specific Changes] Qt 5.5 now unconditionally uses the "using" keyword. Compilers that do not support this keyword are deprecated and will not be able to build Qt. Previous versions of Qt may or may not compile, as no testing was done to ensure it worked. Change-Id: Ief042f34aba555a095d1f342a0ee7ee9feadf42d Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-031-6/+6
| | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractItemView: call canDropMimeData, as one would expect.David Faure2014-11-241-4/+13
| | | | | | | | | | | | | | | | The virtual method was added for 5.0 but never called. The old code (only checking mimetypes) is now the default implementation for canDropMimeData. Model subclasses can now refine this by having index-specific logic instead, or in order to inspect the dropped data (e.g. to accept files and refuse directories, which are all text/uri-list). [ChangeLog][QtWidgets][QAbstractItemView] now calls canDropMimeData in order to decide whether or not to accept the drop. Task-number: QTBUG-30534 Change-Id: Ied3aa964b4025bae6a1a26df89a681bfe61c3faa Reviewed-by: Stephen Kelly <steveire@gmail.com>
* Doc: corrected autolink issues itemmodelsNico Vertriest2014-11-201-4/+4
| | | | | | Task-number: QTBUG-40362 Change-Id: I8423643e47d27358dbbce58009cc9039aecb74cf Reviewed-by: Martin Smith <martin.smith@digia.com>
* Adapt the names in the documentation to the names used in the headerAlbert Astals Cid2014-10-301-8/+8
| | | | | | | This is needed since the names of the header are the ones you have to use in the QML signal handlers to access the variables Change-Id: I507e2ccc05a1fd2c5efd0bf4bef92ed33a186d95 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QAbstractListModel's detailed description.Mitch Curtis2014-10-171-2/+2
| | | | | Change-Id: I3f3e6b9d4e021620505c03458e78856326dcd859 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Merge remote-tracking branch 'origin/stable' into devJ-P Nurmi2014-06-051-15/+15
|\ | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt.prf src/plugins/platforms/xcb/qxcbwindow.h src/tools/qdoc/qdocindexfiles.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I214f57b03bc2ff86cf3b7dfe2966168af93a5a67
| * Fix the doc so it uses the defined parameter names for the signalsAndy Shaw2014-05-241-15/+15
| | | | | | | | | | | | | | | | | | | | The documentation needs to use the defined parameter names for the signals as this is what QML will make them available as if they are used in a connection to that signal. Task-number: QTBUG-35694 Change-Id: I0f56b9e1ace45cfff72c45273dd64766e3c792f2 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Doc: Correct typos in QModelIndex::internalId() documentationAdam Majer2014-02-251-2/+2
|/ | | | | Change-Id: Iea2fd83764711889b828997d56b9f7dcdbdd75fb Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Document QAbstractItemModels::roleNames() better.Mitch Curtis2014-01-151-0/+28
| | | | | | | | | List all of the default role names, and mention that the function must be overridden if the model is used within QML. Change-Id: I6ced5ac74143dcb97c527da2a6a23aa9d21f70e5 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-1/+1
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: Add docs for rvalue references and move constructorsGeir Vattekar2013-09-271-0/+17
| | | | | | | | | These members were introduced in 4.8, but left undocumented. Because we consider undocumented API to be internal, the members are \since 5.2. Change-Id: I52e2840a8cfaa7f59f410b3e2a06c0942ea06539 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Merge branch 'stable' into devSergio Ahumada2013-09-131-3/+3
|\ | | | | | | | | | | | | | | Conflicts: src/concurrent/qtconcurrentmedian.h src/corelib/itemmodels/qabstractitemmodel.cpp Change-Id: Iac46a90bbb2958cef7670031a4b59c3becd8538a
| * Doc: Fix copy+paste errors for QAbstractItemModelSze Howe Koh2013-09-081-3/+3
| | | | | | | | | | Change-Id: Ia462544cc86870d9870ae1be3b4f9135c9efe45c Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | qdoc: Clarify documentation of member functionsMartin Smith2013-08-131-76/+94
|/ | | | | | | | | | | | | | | When implementing a custom subclass of QAbstractItemModel, if the custom model will use MIME types other than the default internal MIME type, the mimeTypes() member must be reimplemented to return the list of allowed MIME types. If mimeTypes() is reimplemented, mimeData(), canDropMimeData(), and dropMimeData() must also be reimplemented to use the allowed MIME types. Task-number: QTBUG-32362 Change-Id: Iee5cf5d2dbed8a6c1f7ab47a7a4b9b03e80e8e59 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: Update description of QAbstractItemModel::supportedDragActions()Topi Reinio2013-07-161-2/+4
| | | | | | | | | | Update documentation for the QAbstractItemModel::supportedDragActions() (virtual since 5.0) and the obsoleted setter function. Task-number: QTBUG-32410 Change-Id: I4f77601bca63e5f782ade1f577104500f541bbb1 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Geir Vattekar <geir.vattekar@digia.com>
* Document undefined behavior regarding Qt::ItemNeverHasChildren.Stephen Kelly2013-03-261-0/+3
| | | | | | Change-Id: I4c044b206ad6dd57f11d791d8a6a6f3f931acf4f Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Merge branch 'dev' into stableOswald Buddenhagen2013-03-201-0/+44
|\ | | | | | | | | | | | | | | | | | | | | | | This starts Qt 5.1 release cycle Conflicts: src/gui/text/qfontdatabase.cpp src/gui/text/qharfbuzz_copy_p.h src/widgets/kernel/qapplication.cpp src/widgets/kernel/qcoreapplication.cpp Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
| * Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-03-051-1/+0
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure qmake/generators/mac/pbuilder_pbx.cpp src/corelib/kernel/qtimerinfo_unix.cpp src/plugins/platforms/cocoa/qcocoabackingstore.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: I8d125fe498f5304874e6976b53f588d3e98a66ac
| * | Provide the resetInternalData slot to cleanly reset data in proxy subclasses.Stephen Kelly2013-01-301-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | This was part of Qt 4.8, but Qt 5.0 was branched before that, so the commit was lost. Change-Id: I2a2ab3c75a0943ac734d588ebd74bc158dd6aaaf Reviewed-by: Nils Jeisecke <jeisecke@saltation.de> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-291-1/+1
| |\ \ | | | | | | | | | | | | refs/staging/dev
| * | | Add the Qt::ItemNeverHasChildren flag and use it in QTreeView.Stephen Kelly2013-01-291-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be used to determine whether expand() should really expand. Change-Id: If79d8c295a4ca1356e60051682b227524a065126 Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | | | Clarify mention of QAbstractItemView in the canFetchMore docs.Stephen Kelly2013-03-191-3/+2
| |_|/ |/| | | | | | | | | | | | | | Change-Id: Ic93054d8fc68497fb0bcc2c5491924b9c57b78ad Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | | Doc: Added the missing example snippetsVenugopal Shivashankar2013-02-261-1/+0
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | The snippet files referred were outside the scope exampledirs for QtCore. I made of a copy of those files in the snippets folder to fix this issue. Task-number: QTBUG-29755 Change-Id: I2f765104394071d035e9cee610945ae290033deb Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Nico Vertriest <nico.vertriest@digia.com>
* | Doc: Fix module name formatSze Howe Koh2013-01-251-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation QtCore -> Qt Core QtDBus -> Qt D-Bus QtDesigner -> Qt Designer QtGui -> Qt GUI QtImageFormats -> Qt Image Formats QtNetwork -> Qt Network QtPrintSupport -> Qt Print Support QtScript -> Qt Script QtSql -> Qt SQL QtSvg -> Qt SVG QtTest -> Qt Test QtWebKit -> Qt WebKit QtWidgets -> Qt Widgets QtXml -> Qt XML QtConcurrent -> Qt Concurrent (partial) QtQuick -> Qt Quick (partial) Also, distinguish between "module" and "library" Change-Id: Icb8aa695ae60b0e45920b0c8fce4dc763a12b0cd Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Docs: Fix referencesChristian Stenger2012-12-131-1/+1
| | | | | 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>
* 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>
* Add hint API to QAIM::layout*Change signals.Stephen Kelly2012-09-291-5/+19
| | | | | | | | | | | | 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>
* QModelIndex: clean up integer size confusion in the APIMarc Mutz2012-09-221-14/+6
| | | | | | | | | | | | | | | | | | | | | | 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-221-24/+24
| | | | | | | | 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>
* 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-031-1/+1
| | | | | | 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-231-13/+19
| | | | | | | | | | | | | | | | | | | 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-231-0/+5
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Doc: Fix snippet and example referencing widget examplesAndy Nichols2012-08-231-1/+1
| | | | | | | | 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>
* Fix the doc errors in itemmodels and itemviews.Stephen Kelly2012-08-201-3/+33
| | | | | | | | | 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>
* Fix a couple of qdoc errorsLars Knoll2012-08-181-13/+0
| | | | | Change-Id: I79f689e08ed4a496052529af38fca72c3d4e04cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>