|
|
|
@ -147,12 +147,7 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch |
|
|
|
|
|
|
|
|
|
bool UBGraphicsItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
|
{ |
|
|
|
|
if(NULL != mMimeData) |
|
|
|
|
{ |
|
|
|
|
QDrag* mDrag = new QDrag(event->widget()); |
|
|
|
|
mDrag->setMimeData(mMimeData); |
|
|
|
|
mDrag->start(); |
|
|
|
|
} |
|
|
|
|
mDragStartPosition = event->pos(); |
|
|
|
|
|
|
|
|
|
startUndoStep(); |
|
|
|
|
|
|
|
|
@ -186,13 +181,27 @@ void UBGraphicsItemDelegate::setMimeData(QMimeData *mimeData) |
|
|
|
|
|
|
|
|
|
bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
|
{ |
|
|
|
|
if((NULL != mMimeData) && ((event->pos() - mDragStartPosition).manhattanLength() < QApplication::startDragDistance())) |
|
|
|
|
{ |
|
|
|
|
QDrag* mDrag = new QDrag(event->widget()); |
|
|
|
|
mDrag->setMimeData(mMimeData); |
|
|
|
|
if (!mDragPixmap.isNull()) { |
|
|
|
|
mDrag->setPixmap(mDragPixmap); |
|
|
|
|
mDrag->setHotSpot(mDragPixmap.rect().center()); |
|
|
|
|
} |
|
|
|
|
mDrag->exec(); |
|
|
|
|
mDragPixmap = QPixmap(); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(isLocked()) |
|
|
|
|
{ |
|
|
|
|
event->accept(); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event) |
|
|
|
|