Say "hello" to categorization on list views

Aaron J. Seigo aseigo at kde.org
Mon Feb 19 18:34:38 GMT 2007


On February 18, 2007, Rafael Fernández López wrote:
> As some users (and myself too) missed the categorization powerful tool for
> Konqueror/Dolphin and similars, I've started a bit on it. This new class
> (attached) is right now locally at kdeui/itemviews. The idea is that the
> list view, should inherit from this class, and of course, rewrite the
> method. This particularly is useful on the new class I'm writing:
> KListView. KListView will give all the benefits for drawing categorized
> items in the viewport, so a new list view that wants to add own
> categorization, the only thing have to do is inherit KListView and rewrite
> this method. As easy as that. On paintEvent() method at KListView, the
> model() will be asked if it is really a QSortFilterProxyModel. If so, it
> will ask this method with the corresponding
> QSortFilterProxyModel::sortRole() method.

sounds like a lot of subclassing, particularly if there are N different views 
that subclass KItemCategorization (KItemCategorizer?) as then one would need 
to subclass each listview for each type of categorization (or have one 
categorizer that does all kinds of categorizations?)

would it be cleaner to simply expect one to sub-class KItemCategorization and 
have a setCategorizer(const KItemCategorization& categorizer) method in the 
listviews? that way one could write categorizers for each type of data set 
(e.g. one for photos vs one for eBooks or whatever) as desired and re-use 
them with whatever listviews support that categorization. this prevents 
destroying and creating listviews just to change the categorization and would 
allow greater re-use of categorization code.

one could also have setCategorizer take a pointer instead of a reference and 
take ownership of the object if that's easier ... though pointers are a bit 
uglier, they can be easier to test for and "clear" (pass in 0)..

also, the screenshot you provided is from windows. do you have a shot of it 
working in kde? (just curious =)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

Full time KDE developer sponsored by Trolltech (http://www.trolltech.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070219/86ea1ea4/attachment.sig>


More information about the kde-core-devel mailing list