diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index b8411b0a..372eba7e 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -640,8 +640,12 @@ UBBoardView::wheelEvent (QWheelEvent *event) { // Too many wheelEvent are sent, how should we handle them to "smoothly" zoom ? // something like zoom( pow(zoomFactor, event->delta() / 120) ) + // use DateTime man, store last event time, and if if less than 300ms than this is one big scroll + // and move scroll with one const speed. + // so, you no will related with scroll event count } - event->accept (); +// event->accept (); + QGraphicsView::wheelEvent(event); } void diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 612527f2..5f2d24ad 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -191,6 +191,19 @@ bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event) return false; } +bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event) +{ + if( mDelegated->isSelected() ) + { + event->accept(); + return true; + } + else + { + event->ignore(); + return false; + } +} bool UBGraphicsItemDelegate::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index 04f4574f..fcab9f8d 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -102,6 +102,7 @@ class UBGraphicsItemDelegate : public QObject virtual bool mousePressEvent(QGraphicsSceneMouseEvent *event); virtual bool mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual bool mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual bool weelEvent(QGraphicsSceneWheelEvent *event); virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); diff --git a/src/domain/UBGraphicsProxyWidget.cpp b/src/domain/UBGraphicsProxyWidget.cpp index 8b8e3d9b..f3b3cc10 100644 --- a/src/domain/UBGraphicsProxyWidget.cpp +++ b/src/domain/UBGraphicsProxyWidget.cpp @@ -99,10 +99,15 @@ void UBGraphicsProxyWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { mDelegate->mouseReleaseEvent(event); - QGraphicsProxyWidget::mouseReleaseEvent(event); } +void UBGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event) +{ + if( mDelegate->weelEvent(event) ) + QGraphicsProxyWidget::wheelEvent(event); +} + void UBGraphicsProxyWidget::setDelegate(UBGraphicsItemDelegate* pDelegate) { diff --git a/src/domain/UBGraphicsProxyWidget.h b/src/domain/UBGraphicsProxyWidget.h index 13de05fb..a7dc5de7 100644 --- a/src/domain/UBGraphicsProxyWidget.h +++ b/src/domain/UBGraphicsProxyWidget.h @@ -48,6 +48,8 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void wheelEvent(QGraphicsSceneWheelEvent *event); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);