Nevermind, problem solved... yet again this forum proved itself a usefull resource (2 posts and no responses).
Anyway the solution was found in qabstractitemmodel.cpp in the QT source files. Here is the reimplementation that worked:
bool BookMarkList
::dropMimeData(int index,
const QMimeData *data, Qt
::DropAction action
) {
QByteArray dropData
= data
->data
("application/x-qabstractitemmodeldatalist");
int iRow, iCol;
while (!stream.atEnd())
{
QMap<int, QVariant> v;
stream >> iRow >> iCol >> v;
QList<QVariant> lsVars;
lsVars = v.values();
itemString = qVar.toString();
}
if ( itemString.length() > 0 )
{
QList<QListWidgetItem *> lsMatch = findItems( itemString, Qt::MatchFixedString );
if ( !lsMatch.isEmpty() )
return true;
}
return true;
}
bool BookMarkList::dropMimeData(int index, const QMimeData *data, Qt::DropAction action)
{
QByteArray dropData = data->data("application/x-qabstractitemmodeldatalist");
QDataStream stream(&dropData, QIODevice::ReadOnly);
QString itemString = "";
int iRow, iCol;
while (!stream.atEnd())
{
QMap<int, QVariant> v;
stream >> iRow >> iCol >> v;
QList<QVariant> lsVars;
lsVars = v.values();
QVariant qVar = lsVars.at(0);
itemString = qVar.toString();
}
if ( itemString.length() > 0 )
{
QList<QListWidgetItem *> lsMatch = findItems( itemString, Qt::MatchFixedString );
if ( !lsMatch.isEmpty() )
return true;
}
QListWidget::dropMimeData(index, data, action);
return true;
}
To copy to clipboard, switch view to plain text mode
Of course this code would have to be modified to allow for other sources and not just the assumed other listwidget on the program. Would have been nice if they had added a property to QListWidget, something like: 'bool allowDuplicates', but oh well.
Bookmarks