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; }
DraggableListModel.java
Description: Binary data
Main.java
Description: Binary data
_______________________________________________ Qt-jambi-interest mailing list Qt-jambi-interest@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest