I created custom proxy model inherited by QSortFilterProxyModel. My source model for the above mentioned proxy model is also a custom model inherited by QAbstractTableModel. Then I set my custom proxy model to a QTableView.
In this custom proxy model, I reimplemented the mimeData(..) function. It is as follows.
QMimeData* CustomProxyModel::mimeData( const QModelIndexList & rListIndexes ) const
{
QMimeData *pMimeData = new QMimeData();
//some code here
connect(pMimeData, SIGNAL( destroyed(QObject*) ), this, SLOT( OnDestroyDraggedItem() ) );
return pMimeData;
}
In Qt4.7, soon after the user dropped an item of the QTableView into somewhere, OnDestroyDraggedItem() slot was called. In other words, QMimeData object is deleted soon after the drag and drop operation.
But in Qt 5.1, OnDestroyDraggedItem() slot is never called. In other words, QMimeData object is never deleted after a drag and drop operation.
Am I doing something wrong? Or Has Qt 5.1 a memory leak after a drag and drop operation ? Is there another way to find a end of a drag and drop operation ?
Maybe it's a bit late - but can't you just inherit
QMimeData
and do something in the destructor? Should be small and safe code of course - throwing exceptions in destructors can cause strange behavior :)