Summary: make it compile without foreach
Test Plan: autotest ok
Reviewers: dfaure
Reviewed By: dfaure
Subscribers: kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D19778
This can be useful for setting up column delegates at the right place,
no matter what the column mapping actually is:
tree->setItemDelegateForColumn(reorderProxy->proxyColumnForSourceColumn(MySourceColumn), ...)
CCMAIL: jesper.pedersen@kdab.com
This test was testing for something that will never work, knowing that
it will never work; it's just that it failed silently before and it even
asserts now. It makes no sense to keep this.
The constructor of QFlags which was intended to handle literal "0"
as commonly used indicator of no-flags-set has been done with a
trick based on pointer types. Which these days of nullptr existing and
compilers pushing to use that sadly fired back and, instead of
allowing convenient code with commonly understood literal "0" values,
resulted in quite some code using "nullptr" to indicate a QFLags-based
type value with no flags set, which can be puzzling for humans
reading the code.
Commit f55b0559 (KExtraColumnsProxyModel: Persist model indexes after
emitting layoutChange, not before, 2016-12-20) missed a unit test, but
the DynamicTreeModel in the proxymodeltestsuite is older and more
advanced than the simplified version added to Qt at some point.
CCMAIL: faure@kde.org
After
int proxyEndRemove = proxyStartRemove;
proxyEndRemove += rc; was adding 0 (empty root)
and then --proxyEndRemove; was making us end up with proxyEndRemove < proxyStartRemove.
REVIEW: 129657
If the row being removed from the source model isn't shown by KRFPM,
it's correct that we don't need to emit any signals, however we still
need to tell our base class QSFPM so that it updates the mappings
of the visible siblings below that removed row.
Testcase: deleting the Last Search folder in kmail
(full integration test for this testcase will be added to mailcommon).
REVIEW: 128428
BUG: 349789
FIXED-IN: 5.25
This was broken by astyle in commit v4.95.0~5 (Code reformatted using
kde-dev-scripts/astyle-kdelibs. Use git blame -w 5d4c2df to show
authorship as it was before this commit., 2013-12-18), because despite
the filenames, this is not really c++ code.
The tests are not as rigourous as possible as they only really check
rowCount changes. However, this is usually enough to ensure internal
consistency in the class, and the attached ModelTest should ensure the
rest.
KSelectionProxyModel listens to two delegate objects for changes: the
source model of the proxy, and the selectionModel. When a QModelIndex
which is selected gets removed, slots connected to signals for both
clients are executed. Whichever slot is executed first updates the
KSelectionProxyModel, and when the other slot is executed it ignores the
already-handled event.
Until Qt 5.5. QItemSelectionModel required the model to be passed in its
constructor. Prior to commit v5.9.0~21 (KSPM: Make the
setSelectionModel method public., 2015-03-08) the KSelectionProxyModel
required the selectionModel to be passed in its constructor.
Because the order of slot execution follows the order of signal slot
connection, the KSelectionProxyModel slot for handling deselection was
always executed first to process the removal.
Since Qt 5.5 and KItemModels 5.9.0, it is possible to set the model on
the QItemSelectionModel and the selectionModel on the
KSelectionProxyModel in a different order, meaning that the
(before/after) slots for handling removal of a row from the source model
is executed first. When the before slot is executed the selectionModel
still has a selection, but by the time the after slot is executed the
selection has already been removed (because QItemSelectionModel updates
its selection on rowsAboutToBeRemoved).
Remove the check for the selection being empty in the after slot to
handle this case.