[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Sorting date and other column types in {K,Q}ListViews
From:       Frerich Raabe <frerichraabe () gmx ! de>
Date:       2001-12-29 15:44:08
[Download RAW message or body]

Am Samstag, 29. Dezember 2001 16:31 schrieb shaheed:
> It seems to me that there is scope for some standardised column sorting
> operators for use with {K,Q}ListViews. For example, the current textual
> sort on Date columns in konqueror's file listview mode is a PITA at best,
> and a bug at worst.
>
> Now, this function is clearly common for several types of data, for
> example:
>
> - for filenames, where one might want directories sorted ahead of regular
> files
>
> - for dates, one wants to sort on the actual date, not its textual
> representation
>
> and is needed in several places like Konqueror and Cervisia. At the moment,
> this is done by different kinds of inconsistent hacks.
>
> What is the best way to tackle this? Perhaps there should be a standard
> {K,Q}ListViewItem's subclasses for storing certain data types?

"virtual int QListViewItem::compare(QListViewItem *entry, int column, bool 
ascending) const" seems to be what you are looking for. Of course it requires 
you to subclass QListViewItem every time you want a new comparsion behaviour. 
Hmm, perhaps it'd be handy to be able to have something like 'typedef int 
(*QListViewItemComparator)(QListViewItem *, QListViewItem)' and then such a 
function to a QListView. That way you could plug in new comparators without 
having to subclass.

- Frerich
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic