theprobe
29th March 2011, 12:30
Hi,
I have two tree views, side by side and I want to drag one item from one tree into the other. So far I have managed to get something working but my problem is that for the QModelIndex that I drag from Tree A, I want its internal pointer to be available in Tree B.
So far the only way I can see to do it is put the pointer into a QByteArray in
QMimeData *MyModel::mimeData(const QModelIndexList &indexes) const
and read it back out in
bool MyModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
Is this really the best way? Streaming pointers feels wrong.
Thanks
I have two tree views, side by side and I want to drag one item from one tree into the other. So far I have managed to get something working but my problem is that for the QModelIndex that I drag from Tree A, I want its internal pointer to be available in Tree B.
So far the only way I can see to do it is put the pointer into a QByteArray in
QMimeData *MyModel::mimeData(const QModelIndexList &indexes) const
and read it back out in
bool MyModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
Is this really the best way? Streaming pointers feels wrong.
Thanks