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

List:       kde-core-devel
Subject:    Re: Fwd: kdelibs/kdeui
From:       Reginald Stadlbauer <reggie () trolltech ! com>
Date:       2000-06-04 13:37:11
[Download RAW message or body]

On Sun, 04 Jun 2000, Stephan Kulow wrote:
> Simon Hausmann wrote:
> > I cannot believe this. After the changes KListView relies on the
> > _private_ member variables of QListViewItem.
> >
> > IMHO if a feature is not implementable in a somewhat clean way, then it
> > should not go into kdelibs.
>
> Definitly, but I would still have a comment from Reggie :)

Well as I saw from that stuff the discussion is not about DnD (that is for 
sure possible without hacks as examles like konqy, Q/KFileDialog, qdirview 
exmple, etc. show) but about the moveAfter method. Unfortunately it is right 
that is currently not possible in QListView. There is the method 
moveToJustAfter() which does what you want, but this one is private :-(( For 
Qt 2.2 I'll make that public with a better name (moveItem() or so). For now 
you can only solve it with hacks. What I have seen from the KListView sources 
it is just a hack which does nothing.... Well, I'd suggest following hack. Do 
in klsitview.cpp

....
#define private public
#include <qlistview.h>
#undef private

...

void KListView::moveItem( QListViewItem *item, QListViewItem *after )
{
	if ( item &&after )
		item->moveToJustAfter( after );
}

Very ugly hack, I know. Alternatively you could save the data of the item 
(text + pixmaps), delete it and create a new one which you can create exatly 
after the one you want to. Of course this will not work with items which have 
some extra data which has to be copied.

-- 
Reggie (reggie@trolltech.com)

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

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