QFileSystemModel and QSortFilterProxyModel - root index is not preserved
-
In the way such behavior breaks SOLID substitute rule - I can't use descendant class QFileSystemModel like it was its base class QAbstractItemModel in QSortFilterProxyModel. While not a 100% bug it's definitely a serious design flaw, and worth to be reported. But where?
@MasterBLB said in QFileSystemModel and QSortFilterProxyModel - root index is not preserved:
But where?
In Qt bug tracker https://bugreports.qt.io/secure/Dashboard.jspa
Also you can talk to Qt developers on their mailing list. -
In the way such behavior breaks SOLID substitute rule - I can't use descendant class QFileSystemModel like it was its base class QAbstractItemModel in QSortFilterProxyModel. While not a 100% bug it's definitely a serious design flaw, and worth to be reported. But where?
breaks SOLID
It doesn't. In fact, if it worked as you expected it would break SOLID
it's definitely a serious design flaw
Sorry to be brutal: No, it's not a flaw, you just didn't understand the design of model/views.
To help you get a better idea of what is going on, try use the same model with 2 different treeviews. In only one of the view callsetRootIndex
, and then trigger the filtering. -
Im actually encountering the very same issue.
Clearly it wont be fixed by Qt since Ive even seen posts about this issue back from 2011.
Could someone help me a little bit by telling me what to do please ?@VRonin You were the most precise, suggesting to implements the setRootIndex to the proxymodel, but I would still require a bit more info if I am to do it on my own please :D
-
It looks like @VRonin implemented his idea. See https://github.com/VSRonin/QtModelUtilities/blob/master/READMERootIndexProxyModel.md