SANKORE-139 fix mouse scroll for active wight on scene

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent 0d8350e5f7
commit bd0ced234d
  1. 3
      src/board/UBBoardView.cpp
  2. 13
      src/domain/UBGraphicsItemDelegate.cpp
  3. 1
      src/domain/UBGraphicsItemDelegate.h
  4. 7
      src/domain/UBGraphicsProxyWidget.cpp
  5. 2
      src/domain/UBGraphicsProxyWidget.h

@ -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);

Loading…
Cancel
Save