Thanks for your answer. However, I already tried this. As I said in my first message, I don't want to override the destination item in my list.
You see, if I uncomment this flag, the GUI final user may erase items. Uncommenting works, but it doesn't give the right functionnality. Thanks again however. Regards. Julien. 2009/7/3 Helge Fredriksen <[email protected]> > Hello, Julien! > > I just ran your example and I think you actually were closer than you > thought. Just uncommented the > > // ItemFlag.ItemIsDropEnabled, > > on line 108, and your items just got dropped as well as anything. > > I guess the documentation on > > > http://doc.trolltech.com/qtjambi-4.5.0_01/com/trolltech/qt/model-view-dnd.html > > should show how to handle the droppings as well as the dragging. > > Regards, > Helge Fredriksen > > > > Julien Gaubert wrote: > > Hi all, > > I'm currently experimenting troubles with D&D in QListView. > I joined a simple QListModel subclass and a main program to illustrate it. > > What I want is to be able to move my items in my list but without > overwritting (i.e I want to implement a re-ordering feature). > > I my test, you can see I overrode insertRows(),removeRows(), data() and > setData() methods so D&D can move the items plus supportedDropActions() and > flags(). > I didn't put "ItemIsDropEnabled" in flags() method in order not to > overwrite items when dropping something on it. > > The problem is that with this implementation of the flags() method, no drop > action is accepted at all (drop indicator show a "forbidden" image). > Moreover, I read the C++ code of dropIndicatorPosition() (see below) and it > seems that with "ItemIsDropEnabled" not being flagged, I should get a > dropIndicator "AboveItem" or "BelowItem". (I didn't try to test my example > in C++ though) > > Does someone know about this issue and/or (even better) have a solution ? > If this is a bug, any workaround would be appreciated :) (I'm quite stuck > with it). > > Best regards. > Julien. > > PS : C++ Code: > QAbstractItemView::DropIndicatorPosition > QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, > const QModelIndex &index) const > { > ... > > if (r == QAbstractItemView::OnItem && (!(model->flags(index) & > Qt::ItemIsDropEnabled))) > r = pos.y() < rect.center().y() ? QAbstractItemView::AboveItem : > QAbstractItemView::BelowItem; > > return r; > } > > ------------------------------ > > _______________________________________________ > Qt-jambi-interest mailing > [email protected]http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest > > >
_______________________________________________ Qt-jambi-interest mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
