cursor pixmap during drag&drop
Hi there,
I'd like to change the cursor pixmap during my drag & drop event.
Drag & drop works perfectly, its only the pixmap I don't know how to change...
I use a QTableView with a subclassed QSqlRelationalTableModel as my model. To enable dragevents I use the m_tableView->setDragEnabled(true) function.
I know u can set the Pixmap using
Code:
drag
->setPixmap
(QPixmap(":/images/drag.png"));
but I don't know, where to use these lines (inside my model, or somewhere else?) or how to do taht exactly?
hope somebody has a solution...
here's the model I'm using:
Code:
#ifndef MYQSQLRELATIONALTABLEMODEL_H
#define MYQSQLRELATIONALTABLEMODEL_H
#include <QSqlRelationalTableModel>
#include <QMimeData>
#include <QByteArray>
#include <QDataStream>
{
Q_OBJECT
public:
Qt::DropActions supportedDropActions() const
{
return Qt::CopyAction;
}
{
if (index.isValid())
return Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
else
return Qt::ItemIsDropEnabled | defaultFlags;
}
QMimeData *mimeData
(const QModelIndexList
&indexes
) const {
... //encode my data
mimeData->setData("myMimeData", encodedData);
return mimeData;
}
};
#endif
regards
darksaga
Re: cursor pixmap during drag&drop
Unfortunately the model architecture doesn't support that currently (Qt4.3).