Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
shibakaneki 13 years ago
commit 724a0dba36
  1. 6
      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

@ -640,8 +640,12 @@ UBBoardView::wheelEvent (QWheelEvent *event)
{ {
// Too many wheelEvent are sent, how should we handle them to "smoothly" zoom ? // Too many wheelEvent are sent, how should we handle them to "smoothly" zoom ?
// something like zoom( pow(zoomFactor, event->delta() / 120) ) // 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 void

@ -191,6 +191,19 @@ bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
return false; return false;
} }
bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event)
{
if( mDelegated->isSelected() )
{
event->accept();
return true;
}
else
{
event->ignore();
return false;
}
}
bool UBGraphicsItemDelegate::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) bool UBGraphicsItemDelegate::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {

@ -102,6 +102,7 @@ class UBGraphicsItemDelegate : public QObject
virtual bool mousePressEvent(QGraphicsSceneMouseEvent *event); virtual bool mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual bool mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual bool mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual bool mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual bool weelEvent(QGraphicsSceneWheelEvent *event);
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change,
const QVariant &value); const QVariant &value);

@ -99,10 +99,15 @@ void UBGraphicsProxyWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void UBGraphicsProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
mDelegate->mouseReleaseEvent(event); mDelegate->mouseReleaseEvent(event);
QGraphicsProxyWidget::mouseReleaseEvent(event); QGraphicsProxyWidget::mouseReleaseEvent(event);
} }
void UBGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event)
{
if( mDelegate->weelEvent(event) )
QGraphicsProxyWidget::wheelEvent(event);
}
void UBGraphicsProxyWidget::setDelegate(UBGraphicsItemDelegate* pDelegate) void UBGraphicsProxyWidget::setDelegate(UBGraphicsItemDelegate* pDelegate)
{ {

@ -48,6 +48,8 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);

Loading…
Cancel
Save