Hi everybody,
I read the Drag and Drop with Item views tutorial but somehow, drag drop is only working when im droping on an existing item within the treeview.
How do I drop items on the empty area within a treeview?
thx in advance,
Mike
Hi everybody,
I read the Drag and Drop with Item views tutorial but somehow, drag drop is only working when im droping on an existing item within the treeview.
How do I drop items on the empty area within a treeview?
thx in advance,
Mike
take a look at the function where the dropaction is accepted. Their must be something e.g. that makes the invisible parent item rejecting drops (or something similar).
hmm it looks like this:
Qt:ropActions CLTLectionModel::supportedDropActions() const
{
return Qt::CopyAction | Qt::MoveAction;
}
how do i drop on the top level of my treeview? do i have to edit my custom model?
Reimplement QAbstractItemModel::flags() to return Qt::ItemIsDropEnabled (together with other flags) for invalid indexes.
J-P Nurmi
Hi jpn,
my flags already contain such flags. Do you have any other idea?
Qt Code:
{ if (!index.isValid()) return Qt::ItemIsEnabled; return QAbstractItemModel::flags(index) | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; }To copy to clipboard, switch view to plain text mode
Last edited by jpn; 14th May 2008 at 13:30. Reason: missing [code] tags
I think Qt::ItemIsEnabled for invalid items is pointless. Also, you are not returning Qt::ItemIsDropEnabled for invalid items..
J-P Nurmi
T1c4L (14th May 2008)
Bookmarks