Commit 18245d72 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

DnD on widget fix

parent 1fd290d6
...@@ -181,27 +181,31 @@ void UBGraphicsItemDelegate::setMimeData(QMimeData *mimeData) ...@@ -181,27 +181,31 @@ void UBGraphicsItemDelegate::setMimeData(QMimeData *mimeData)
bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event) bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
if((NULL != mMimeData) && ((event->pos() - mDragStartPosition).manhattanLength() < QApplication::startDragDistance())) if(mMimeData)
{ {
QDrag* mDrag = new QDrag(event->widget()); QDrag* mDrag = new QDrag(event->widget());
mDrag->setMimeData(mMimeData); mDrag->setMimeData(mMimeData);
if (!mDragPixmap.isNull()) { if (!mDragPixmap.isNull()) {
mDrag->setPixmap(mDragPixmap); mDrag->setPixmap(mDragPixmap);
mDrag->setHotSpot(mDragPixmap.rect().center()); mDrag->setHotSpot(mDragPixmap.rect().center());
}
mDrag->exec();
mDragPixmap = QPixmap();
return true;
} }
mDrag->exec();
mDragPixmap = QPixmap();
return true;
}
if(isLocked()) if(isLocked())
{ {
event->accept(); event->accept();
return true; return true;
} }
else
{
return false;
}
return true;
} }
bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event) bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment