Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QAbstractItemModel + QSortFilterProxyModel leads to random item expansion
Video repro: https://imgur.com/a/ahBSuhH
Repro code: https://gist.github.com/salvaom/c5531458251d77d753bfda57e3895756
The issue is quite obvious, when using a custom
QSortFilterProxyModelitems are expanded randomly when selecting items. I've been experiencing this issue since PySide(1), in Windows and Centos7. I have a feeling that it's something I'm doing wrong since I believe this case is common enough for others to have attempted it.
This does not happen without the
QSortFilterProxyModeland at this point I'm lost on why could this happen.
Does somebody know what I'm doing wrong? Is it perhaps a bug in Qt?
Hi and welcome to devnet,
Sorry I do not have a machine at hand but what do you get you enable recursive filtering ?
Thanks for the reply @SGaist, yes it keeps happening with recursive filtering. Just as a reference, I'm testing with Python 2 and 3, and PySide(1), 2 and 6 in Windows and they all seem to have the same result, having in consideration that PySide(1) does not have the
salvaom last edited by salvaom
This is odd... After further testing I've seen that it also happens with
QStandardItemModelbut it only happens for models with a
Still with the proxy model ?
QAbstractItemModelbased model with a
QSortFilterProxyModelseems to be the combination.
I've been trying to debug it with little success. I've seen that it's no based on the selection but on the cursor, I've tested with expanding the items avoiding selection and it works fine, it's when the current cursor is moved there (
QTreeView.moveCursor), but again, only if the conditions above are met.