[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Moving a QListViewItem
From: Charles <charles () altair ! dhs ! org>
Date: 2000-06-02 2:54:28
[Download RAW message or body]
On Thu, 01 Jun 2000, you wrote:
> On Fri, 02 Jun 2000, Charles wrote:
> > On Thu, 01 Jun 2000, you wrote:
> > > On Fri, 02 Jun 2000, Charles wrote:
> > > > Does anyone have an idea on how to move a QListViewItem safely?
> > > >
> > > > Just copying the strings in a QListViewItem makes it impossible to handle if
> > > > the item has an image, or someone has created their own QListViewItem (class
> > > > MyItem : public QListViewItem). I need a generic way of doing this?
> > > >
> > > > See if you can finish this function :)
> > > >
> > >
> > > /* Insert documentation here, what is this method meant to do? */
> > >
> > > > void KListView::moveItem(QListViewItem *item, QListViewItem *after)
> > > > {
> > > // insert sanity checks
> > > if (item->parent())
> > > item->parent()->takeItem( item )
> > > else
> > > takeItem( item );
> > >
> > > if (after)
> > > after->insertItem( item );
> > > else
> > > insertItem( item );
> > > > }
> >
> > The issue with this is that "after" is the item that you insert it after, not
> > under.
>
> So my guess as to what moveItem should do was incorrect. I think if you
> create a moveItem method it should do what I've suggested above, anything else
> is confusing.
>
> If you want to order the items in a QListView then I think the correct way to do
> that is to override QListView::key. But if you do that in KListView then that
> could cause problem for classes that inherit from KListView, which is a good
> example of why I think KListView is a bad idea.
Well. KListView isn't my idea. in fact, all these hacks were for a listview I
was making, and somehow found its it way right into KListView itself.. :)
But anyway, I'm stuck with it.
I think this is a serious flaw in QListView, even if KListView is a bad idea.
/me nudges the trolls. There should be a method for this, and, correct me if
I'm wrong, it would be binary compatible [for them] to add it.
My question is, why can an item be added anywhere ( QListViewItem(parent,
_after_) ), yet cannot be moved?
Oh Trolls....? :)
>
> BFN,
> Don.
>
> >> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
--
Charles - charles@kde.org
>> Visit http://master.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