I've actually done the manual approaches before with raw widgets, this is
partially because I think that the model/view approach is actually the best
way to handle this particular scenario, and partially because I want to
know more of the ins and outs of Qt's systems. Mostly the former, but I do
l
Ya actually there are a number of ways to work with drag and drop,
depending on what classes you are using. Like you have said, there is
dropMimeData on the model if you want to handle it there, and startDrag on
the view if you want to handle it there, and then more manual approaches
with starting
Just an update; from my research, it looks like I need to subclass
QTreeView to do this. The default implementation of startDrag from
QAbstractItemView apparently is what will delete the original item after
everything's said and done, which checks out with reading the source code
of qabstractitemv
I'm glad we're all on the same page. Looking into Justin's mention of
"taking" the item, I do see that functionality in the Convenience Widgets
(QTreeWidget, etc), but not in QAbstractItemModel. Same with Marcus'
suggestion of moveRow(). I might be looking at the wrong documentation...(
http://sr
Rather than serialising and de-serialising your item each time, you could
instead keep track of origin and destination *indexes* of the operation;
and then re-order the items accordingly.
For example, if you’ve got these items in your model.
item0
item1
item2
item3
And in your drag and drop oper
I can check into the take aspect. I haven't used it specifically, so it's
worth a try.
On Wed, Mar 11, 2015 at 2:24 PM, Joe Weidenbach wrote:
> I should note that more specifically, for getting this to work currently,
> I create a clone of my original element in the dropMimeData function of my
I should note that more specifically, for getting this to work currently, I
create a clone of my original element in the dropMimeData function of my
model, and put that clone in place. Qt Deletes my original automatically
after the fact. I know this is happening because if I do a debug
inspection