Commit bd0ced23 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

SANKORE-139 fix mouse scroll for active wight on scene

parent 0d8350e5
......@@ -641,7 +641,8 @@ 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) )
}
event->accept ();
// event->accept ();
QGraphicsView::wheelEvent(event);
}
void
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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)
{
......
......@@ -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);
......
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