Bug 386722 - Broken KRecursiveFilterProxyModel::match for roles >= Qt::UserRole with sorted models
Summary: Broken KRecursiveFilterProxyModel::match for roles >= Qt::UserRole with sorte...
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-kitemmodels
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other All
: NOR major
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-10 21:12 UTC by Filipe Azevedo
Modified: 2022-12-10 05:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filipe Azevedo 2017-11-10 21:12:19 UTC
I had some bugs with QComboBox::findData().
After investigation the problems seems to comes from this model (KRecursiveFilterProxyModel).
For some reason (i'm lazy to read the entire code to know why it does that), if the role is >= Qt::UserRole then the model use an own mechanism to do the match.
This is causing a lots of issues because it break linearity of the proxy model lookup.
ie, instead of looking the (proxy)model from 0 to rowCount as requested @ [1], the mapping from proxy to source force a start change [2] - it now starts at the (source)model row, which depending the (proxy)model sorting can be the middle to last rows of the source model, to (source)model rowCount, vanishing anything before the source start.
The result behavior is that many possible and valid matches are skipped because QComboBox::findData is not wrapping by default.
Manually adding the Qt::MatchWrap flag fix the issue for my case, though I don't find it the correct fix, simply because it break the natural order of the returned indexes compared to the normal match() algorithm.

[1]: https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qcombobox.cpp.html#1581
[2]: https://code.woboq.org/qt5/kf5/kitemmodels/src/krecursivefilterproxymodel.cpp.html#288
Comment 1 Filipe Azevedo 2017-11-10 21:15:48 UTC
In plus to the reported natural order break, this also break proxies defining roles in themselves not present in the source model.
Comment 2 Justin Zobel 2022-11-10 08:52:18 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 3 Bug Janitor Service 2022-11-25 05:19:20 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2022-12-10 05:16:12 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!