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

List:       kde-devel
Subject:    Re: KListView and sorting items
From:       André_Wöbbeking <Woebbeking () onlinehome ! de>
Date:       2005-10-16 7:43:52
Message-ID: 200510160943.53107.Woebbeking () onlinehome ! de
[Download RAW message or body]

Hi Giovanni,

On Saturday 15 October 2005 23:44, Giovanni Venturi wrote:
> Hello,
> I'm using KListView class, expecially:
>
> void KListView::setSorting   (   int   column,
>   bool   ascending = true
>   )
>
> I discovered that if it has to manage a lot of elements it is very
> slow. 20'000 sorted produce a freezing of the GUI of about 8 seconds.
> Is it possible to do something to don't freeze the gui? 

Override QListViewItem::compare() to compare the data without conversion 
into QStrings. Also override QListViewItem::text() then the conversion 
is only necessary if the item is visible. For example

    class MyItem : public QListViewItem
    {
    public:

        virtual int compare(QListViewItem*, int, bool) const;

        virtual QString text(int) const;
    };



Cheers,
André
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

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

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