I solved it...
bool MyModel
::dropMimeData(const QMimeData *data, Qt
::DropAction action,
int row,
int column,
const QModelIndex &parent
) {
if (parent.isValid())
{
if (row < 0) //dropped on item
qDebug() << "append as child to item: " << itemTo->data().toInt();
else //dropped between two items
{
itemTo = itemFromIndex(insert);
qDebug() << "insert as sibling before: " << itemTo->data().toInt();
}
}
....
}
bool MyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
if (parent.isValid())
{
QStandardItem *itemTo = itemFromIndex(parent);
if (row < 0) //dropped on item
qDebug() << "append as child to item: " << itemTo->data().toInt();
else //dropped between two items
{
QModelIndex insert = parent.child(row, column);
itemTo = itemFromIndex(insert);
qDebug() << "insert as sibling before: " << itemTo->data().toInt();
}
}
....
}
To copy to clipboard, switch view to plain text mode
Bookmarks