https://bugs.kde.org/show_bug.cgi?id=471495
Bug ID: 471495 Summary: [Feature request] KselectionPoxyModel SubTreesWithoutRoots add NearestFolder mode to avoid an empty view Classification: Frameworks and Libraries Product: frameworks-kitemmodels Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: wishlist Priority: NOR Component: general Assignee: kdelibs-b...@kde.org Reporter: ondrej.pop...@gmail.com Target Milestone: --- To start with, I can not change the "Component" field from "general" to anything else such as "KSelectionProxyModel" in this form. SUMMARY Hi, I am migrating my own implementation of SubTreesWithoutRoots to the KSelectionProxyModel SubTreesWithoutRoots filtermode. However, the way I have implemented this, in case only item(s) without children are selected, to set the rootindex to their parents instead. In this way the childless item will show up in the secondary view together with all its siblings. I figured that this mode is more useful than having a completely empty secondary view because an empty secondary view is not very useful so you might do something else with it instead. Now, KSelectionProxyModel does not do this in the SubTreesWithoutRoots filtermode and shows an empty secondary view. I looked over the sourcecode whether I could enhance this, but it is quite complicated so I figured the easiest way for me to make this work with the KSelectionProxyModel is to subclass it and add a proxy on top of the selection model of the view and feed that to the KSelectionProxyModel. The proxy will then "monitor" (with the help of the appropriate signals) the state of the selection model of the view, and mirror it unless only childless items are selected in the SubTreesWithoutRoots filtermode. In that case the proxy will select their parents instead. I figured further to call this mode SubTreesWithoutRootsNearestFolder. So in case an item is selected that has children this item is then the nearest folder, otherwise when it is childless, its parent will be the nearest folder. So, this will probably work for me, and I thought to let you know about this may you be interested. Maybe to add this proxy to the KSelectionProxyModel so it will mirror the selection model of the view by default, and let the users customize it further? In any case, have a nice day! -- You are receiving this mail because: You are watching all bug changes.