summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qsortfilterproxymodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few overrides in Qt CoreAlessandro Portale2018-09-251-1/+1
| | | | | | | | | | | | | | | | This change removes redundant 'virtual' from function declarations. Clang Tidy's modernize-use-override check reports: warning: 'virtual' is redundant since the function is already declared 'override' CppCoreGuidelines say: C.128: Virtual functions should specify exactly one of virtual, override, or final Change-Id: I9a4bdd6cc041d46ae64b25597ba4f7268ac4c2b7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
* QSFPM: cleanup QRegularExpression includesSamuel Gaist2018-09-031-1/+0
| | | | | | | | Add feature guard around the include in the header and remove the one from the implementation file. Change-Id: I8dc133cce786ead6059cc66b40a0ffb6c420096f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-08-221-2/+2
|\ | | | | | | | | | | | | | | | | Conflicts: src/gui/text/qtextengine.cpp tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h Change-Id: Ib9f968edbb0f3387c89bc25e914321d0738bfadc
| * QSortFilterProxyModel inserting at bottom of source modelLuca Beldi2018-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, if you try to insert a row at the bottom of QSortFilterProxyModel the row will be inserted in the source model at position proxy->rowCount rather than at the bottom. This causes insert at apparently random positions in the source. [ChangeLog][QtCore][QSortFilterProxyModel] QSortFilterProxyModel::insertRows(row,count,parent) with row == QSortFilterProxyModel::rowCount will insert at the bottom of the source model rather than at the row QSortFilterProxyModel::rowCount of the source model Task-number: QTBUG-58499 Task-number: QTBUG-69158 Change-Id: Ie78416c8fbc429303b8c9c98375630e3e4d85f6d Reviewed-by: David Faure <david.faure@kdab.com>
* | Add support for QRegularExpression to QSortFilterProxyModelSamuel Gaist2018-08-191-19/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the support for QRegularExpression in QSortFilterProxyModel. [ChangeLog][QtCore][QSFPM] QSortFilterProxyModel now supports QRegularExpression. Task-number: QTBUG-46810 Change-Id: If932d55f98f9b8bcf3a72c03ffd51da52cb50ad1 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-291-1/+4
|\| | | | | | | Change-Id: I8d8b03ea46c537b091b72dc7b68aa6aa3a627ba6
| * QSortFilterProxyModel: don't assert when old model gets destroyedChristian Ehrlicher2018-05-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a new model was set with setSourceModel() and the mapping was built up, the destruction of the old model caused a reset in the QSortFilterProxyModel which lead to an empty view or an assertion. Now we properly disconnect the old model again and also clean up the old mapping/persistent indexes when a new source model is set. Task-number: QTBUG-44962 Task-number: QTBUG-67948 Task-number: QTBUG-68427 Change-Id: I2e0612899c210bde3ac0cfa59aefd78269deee5b Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-03-281-5/+0
|\| | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_mouse.mm src/testlib/testlib.pro Change-Id: Ia0ce4243418fe6a485b0f290c67bd433b3b04ff2
| * Make sure we can build with -no-feature-itemmodelUlf Hermann2018-03-211-5/+0
| | | | | | | | | | | | | | Various pieces of code have to be disabled in this case. Change-Id: I83b133f17e9f024016a79c9103293627185449d2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | QSFPM: Faster row removesTim Angus2018-03-131-0/+13
|/ | | | | | | | | | | | | | | When the source model of a QSortFilterProxyModel has rows removed, a mapping is performed in order to figure out which corresponding rows in the sorted and filtered view of the model are affected. In doing so it constructs a vector of removal intervals which are subsequently used to emit rowsRemoved signals. In the case where many rows are removed (e.g. all of them), many removal intervals are identified that are often adjacent and could be simplified, which is what this patch does. i.e. instead of emitting 3 rowsRemoved for 0-3, 4-6, 7-12, now a single rowsRemoved is emitted for 0-12. Change-Id: Ia503091cc4928378c88257cd8b431582e9ff454e Reviewed-by: David Faure <david.faure@kdab.com>
* QSortFilterProxyModel: annotate some deprecated functions as deprecatedChristian Ehrlicher2018-01-171-7/+6
| | | | | | | | | QSortFilterProxyModel::clear() and filterChanged() are deprecated since Qt4.3 but not annotated with QT_DEPRECATED. Change-Id: Ia468203802b6be0596f0a48d51f1da3fa55b724b Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * Fix naming of new property QSortFilterProxyModel::recursiveFilteringDavid Faure2017-11-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | Add "Enabled" to match Qt API naming rules. + fix \since tag. Change-Id: Iaf312648f7385cd7e8d3d101b561fbd4e955df25 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QSortFilterProxyModel: Clear persistent indexes on source model changeChristian Ehrlicher2017-11-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | When a new source model was set to QSortFilterProxyModel, the model tried to remap the persistent indexes to the new model which was wrong. The correct solution is to clear the persistent indexes with _q_sourceModelDestroyed() since the old source model went away. Task-number: QTBUG-44962 Change-Id: Id39e9ac83324250e8bfa434aae467a9206d2590e Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-191-1/+1
|/ | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QSFPM: Avoid following a reset with unnecessary layoutChangedStephen Kelly2017-06-281-1/+1
| | | | | | | | | | | | | | | Follow the pattern used to guard Private::sort() calls elsewhere in the class. Because QAbstractItemModel::sort() is not called in the unit test, the content is not sorted after resetting. [ChangeLog][QtCore][QSortFilterProxyModel] QSortFilterProxyModel now does not emit an unnecessary layoutChanged() following a model reset. Change-Id: I0a36c7fbb172bdd06ecddb489c5595debbef6cb9 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Remove a QT_STRICT_ITERATORS ifdefSérgio Martins2017-05-201-6/+1
| | | | | | | | Having special code paths defeats the purpose of QT_STRICT_ITERATORS and is ugly. Change-Id: Ie0bdbf1a9639a0903bcd020f526629ab2e69883b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QSFPM optimization in dataChanged: don't re-sort if the order didn't changeDavid Faure2017-03-231-12/+43
| | | | | | | | | | We can quickly check if the change affects sorting by checking whether lessThan(N-1, N) and lessThan(N, N+1) are still true. If this is the case for all changed rows, then we can skip the whole remove+insert+layoutChanged(). Task-number: QTBUG-1548 Change-Id: Ia778b3e8880cc9909eef1f8a016c84235870353d Reviewed-by: Stephen Kelly <steveire@gmail.com>
* Add support for recursive filtering in QSFPMFilipe Azevedo2017-03-141-98/+249
| | | | | | | | You can now use the recursiveFiltering property to recurse into children to find potential matching children to filter in. Change-Id: I411a2fb29489fd56b9c881b3e6b8d1860cce630c Reviewed-by: Stephen Kelly <steveire@gmail.com>
* QSFPM: Remove data manipulation from move handlersStephen Kelly2016-12-211-55/+12
| | | | | | | | | | | | Similar to the fix in the parent commit, incorrect updating of the internal data structures during layout changes can lead to dangling pointers being dereferenced later. Moves are treated as layoutChanges by this proxy by forwarding to the appropriate method. However, data is incorrectly cleared prior to that forwarding. Remove that, and let the layoutChange handling take appropriate action. Change-Id: Iee951e37152328a4e6a5fb8e5385c32a2fe4c0bd Reviewed-by: David Faure <david.faure@kdab.com>
* QSFPM: Fix handling of source model layout changeStephen Kelly2016-12-211-20/+11
| | | | | | | | | | | | | | | | | | | | | | | In sourceLayoutAboutToBeChanged the source model update is ignored if the affected parents are filtered out anyway. The same logic is attempted in the sourceLayoutChanged slot, but there the early-return logic is applied too late - the mapping is cleared before performing the early-return. Because pointers into the mapping are used in the internalPointer of QModelIndexes in this class, persistent indexes used later will segfault when attempting to dereference it. Additionally, if a parent becomes invalid as a result of the layoutChange, it would be filtered out by the condition in the loop, resulting in a different result in the comparison of emptiness of the parents container. Fix that by persisting the parent's container, and performing the test for early-return before clearing the mapping. Task-number: QTBUG-47711 Task-number: QTBUG-32981 Change-Id: If45e8a1c97d39454160f52041bc9ae7e337dce97 Reviewed-by: David Faure <david.faure@kdab.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-091-2/+4
|\ | | | | | | Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-051-2/+4
| |\ | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
| | * QSortFilterProxyModel: Don't forward the hint from source's layoutChanged signalOlivier Goffart2016-08-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't forward a VerticalSortHint or HorizontalSortHint hint, because we might be filtering extra items. The documentation of QAbstractItemModel::LayoutChangeHint states: Note that VerticalSortHint and HorizontalSortHint carry the meaning that items are being moved within the same parent, not moved to a different parent in the model, and not filtered out or in. And some of the views rely on this assumption (QQmlDelegateModel for example) What happens in the test is the following: - 'model' emit the dataChanged signal when its data is changed. - 'proxi1' QSortFilterProxyModelPrivate::_q_sourceDataChanged does not forward the dataChanged signal imediatly, it will instead first re-sort the model and call layoutAboutToBeChanged / layouChanged with the VerticalSortHint - 'proxy2' would forward the layoutAboutToBeChanged with the hint, but in QSortFilterProxyModelPrivate::_q_sourceLayoutChanged, it will redo the mapping which will cause the changed data to be filtered. So proxy2 can't forward the VerticalSortHint as it removed rows in the process. Change-Id: I20b6983e9d18bf7509fe6144c74f37d24e4a18c2 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
* | | ItemModel: Extract Method isVariantLessThan()Anton Kudryavtsev2016-07-021-34/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | As noted in comments, QSortFilterProxyModel and QStandardItemModel duplicate code to compare QVariant; extract this into a separate method they can share. Since there is only one common suitable header for both files, the method was placed in qabstractitemmodel.cpp Change-Id: I82bb4a2d6084059b8a70a8d556c16f1a29f4f686 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | CoreLib: use const (and const APIs) moreAnton Kudryavtsev2016-04-181-3/+3
| | | | | | | | | | | | | | | | | | | | For CoW types const methods will be called. Mark store_persistent_indexes() as const, because this method does not modify the object. Change-Id: Ic867913b4fb5aaebfbaaffe1d3be45cf7b646403 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QtCore: use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Saves ~750b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I8bf3e46cd5a6b2cae0ceb3e355a50f61925c63d3 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | QtCore: replace uses of inefficient QList<QPair>s with QVectors [itemmodels]Marc Mutz2016-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | These QPairs are larger than a void*, so holding them in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by holding them in QVector instead. Change-Id: Ie8d8eff3448ada7aef5dfba7fc701a59821f5b54 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | 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-3/+3
|/ | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.5' into devFrederik Gladhorn2015-08-061-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: doc/global/qt-cpp-defines.qdocconf src/3rdparty/forkfd/forkfd.c src/corelib/codecs/qtextcodec.cpp src/corelib/kernel/qmetatype.cpp src/corelib/tools/qset.qdoc src/gui/accessible/qaccessible.cpp src/gui/image/qpixmapcache.cpp src/opengl/qgl.cpp src/tools/qdoc/generator.cpp src/widgets/kernel/qwidget.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp Change-Id: I4fbe1fa756a54c6843aa75f4ef70a1069ba7b085
| * Fix typo in filterAcceptsColumn docs: row is used in place of columnSamuel Gaist2015-07-281-1/+1
| | | | | | | | | | Change-Id: Ic0ec62e4d5c4a4b1d71f14c5d3133657341d4fe3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-2/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * Fix less-than comparison for QStandardItem and QSortFilterProxyModel with ↵Friedemann Kleint2015-06-111-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | invalid data. Previously, QStandardItem::operator<() returned true when both items had invalid data. With MSVC in debug mode (checked iterators/STL), this triggered an assert in tst_QStandardItem::sortChildren() since that verifies that !(b < a) when a < b: Debug Assertion Failed! Line: 3006 Expression: invalid operator< Introduce a stable sort order for invalid items such that other items are always less than invalid items and comparing invalid items returns false (indicating equivalence). Change-Id: Ica0f0d9f001c86973b1941dbcc1faf282e4c47df Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Use QVector::reserve() all over the place.Sérgio Martins2015-06-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Reduces internal memory fragmentation. The search criteria was: QVector::append(), QVector::push_back(), QVector::operator<<() and QVector::operator+=() calls inside for, do and while loops. Statements inside ifs and out of loops weren't considered. Change-Id: Ie5aaf3cdfac938994e6e5dfa5f51de501ed79a0c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QSortFilterProxyModel: Keep invalid index updated on source model sortDaiwei Li2015-06-251-0/+21
| | | | | | | | | | | | | | | | | | | | | | If we have a filter applied that removes all entries, the source model is sorted, and then we remove the filter, QSortFilterProxyModel never emits rowsInserted. This is because it doesn't have the correct source mapping and doesn't update when the filter is removed. Change-Id: I447b2d150e509b128d27f4dabc4e081ca4ef037f Task-number: QTBUG-46282 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | core: Add several QList::reserve() calls.Sérgio Martins2015-06-111-2/+8
|/ | | | | | | Reduces reallocations. Change-Id: Ib63539fb690a80245d8fe81ff8468e79ffa8e57c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QSortFilterProxyModel: improve formal argument naming for lessThanGiuseppe D'Angelo2015-05-011-5/+5
| | | | | | | | | | | | Make it clear (just like the other methods) that the indexes refer to the source model, not the proxy model. There was already a note in the documentation, but it was at the end of it; instead, change the formal arguments names. Change-Id: Ia9592f2b080ff276a62de1713a9623e0f3a50cf6 Reviewed-by: Tobias Koenig Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: David Faure <david.faure@kdab.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>
* QSortFilterProxyModel: fix a regressionGiuseppe D'Angelo2015-01-171-1/+5
| | | | | | | | | | | | | | | | | | | bec1854cc023fb705319c582a636d5f484adafcc introduced a regression: when sorting a tree model, children items would not follow the sorted parents any more (they wouldn't be remapped correctly), resulting in crashes. So, the fix needs more reasoning; let's revert the fix, but leave the original test around for any subsequent attempt, and introduce a new test which looks for the right behavior when sorting trees. This commit partially reverts bec1854cc023fb705319c582a636d5f484adafcc. Task-number: QTBUG-43827 Change-Id: Ic83ac53aef639f870f6c36a8b4b2992f5b485b13 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Volker Krause <volker.krause@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>
* QSortFilterProxyModel: honor the roles parameter of dataChangedGiuseppe D'Angelo2014-12-071-7/+9
| | | | | | | | | | | | | | | | | | | When the source model emits dataChanged, it may tell which roles have been changed. That information was lost when using a QSortFilterProxyModel -- the proxy simply dropped that argument (meaning "all roles may have changed"). It's instead a good idea to forward the roles argument, as it may minimize hits on the proxy (on unchanged roles). [ChangeLog][QtCore][QSortFilterProxyModel] QSortFilterProxyModel now properly forwards the roles that have been changed when the source model emits dataChanged(). Task-number: QTBUG-35440 Change-Id: Ifa5213866ba04dfd57d50b5fbd47638f2191eb8e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-031-1/+1
| | | | | | | | | | 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>
* QAbstractProxyModel: fix canDropMimeData/dropMimeData implementationsDavid Faure2014-11-241-18/+2
| | | | | | | | | | | | | | | The code in 4696e9dbaa4 was incorrect. It is perfectly valid to call these methods with row=-1 column=1 parent=some_index, this is exactly what happens in QListView and QTableView. Child row/column is only for trees. Move the coordinate mapping from QSortFilterProxyModel into a new mapDropCoordinatesToSource internal method, used by QAbstractProxyModel. Task-number: QTBUG-39549 Change-Id: I3312210473d84b639cbe4c01f70ea36437db3e91 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Stephen Kelly <steveire@gmail.com>
* QSortFilterProxyModel: keep the sorting on unrelated changesGiuseppe D'Angelo2014-11-201-5/+1
| | | | | | | | | | | | | | | | | | | | | Whenever the source model of a QSortFilterProxyModel changes, and the changes involve the sorted column, the implementation removes the changed rows from the mapping, sorts them, and inserts them back; in case of identical items, the rows are inserted at the end of the block of equal rows. The problem is that if the change doesn't actually happen on the roles that are used for sorting, then we shuffle the rows, terribly confusing the user. The typical case is a model with identical checkable rows: (un)checking one row will move it at the end. So, instead of trying to be smart with the removal/sort/insert sorted, simply resort everything under the changed parent index. Since the sorting used is stable, this keeps the items in the same positions. Task-number: QTBUG-1548 Change-Id: Id0e61bd49da53b0a3e8aefa6b6893ac41179dc6f Reviewed-by: David Faure <david.faure@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Doc: Mention that QSortFilterProxyModel::lessThan() handles floatsSze Howe Koh2014-03-041-0/+1
| | | | | | Change-Id: Iaf97d22fad3724d1910b18b6d38a06eae4c909ca Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: Replace obsolete types with their newer counterpartsSze Howe Koh2014-02-251-10/+10
| | | | | | | | | This patch ignores: - Docs for obsolete types themselves - Comparisons between new and obsolete types Change-Id: Id9b1e628255113e7c44520abe0f8a4e0db4a283d Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-3/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| * Fix sorted QSortFilterProxyModel filter updateNils Jeisecke2014-02-031-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When changing a filter so that a previously empty proxy model becomes populated sorting was not applied correctly. This was caused by using mapToSource for getting source_sort_column from proxy_sort_column. For an empty proxy model this won't work because no valid proxy index can be created in this case. We now directly use the root index column mapping instead by doing essentially the same as QSortFilterProxyModelPrivate::proxy_to_source but without the sanity checks needed for external use. The sorting feature of QSortFilterProxyModel has always assumed that the number of columns is specified by columnCount(QModelIndex()) so the behavior doesn't change. [ChangeLog][QtCore][QSortFilterProxyModel] Fixed sorting when a previously empty proxy model becomes populated because of a change in the filter. Task-number: QTBUG-30662 Change-Id: I21322122e127889dfadc02f838f0119ed322dcab Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>