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

preferencesAboutTextFull
shibakaneki 13 years ago
commit f01bc84042
  1. 1
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 29
      src/board/UBBoardView.cpp
  3. 4
      src/domain/UBGraphicsItemDelegate.cpp
  4. 3
      src/domain/UBGraphicsProxyWidget.cpp

@ -2415,6 +2415,7 @@ UBGraphicsCurtainItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::curtainItemFromSvg
QRectF rect = curtainItem->rect(); QRectF rect = curtainItem->rect();
rect.setWidth(svgWidth.toString().toFloat()); rect.setWidth(svgWidth.toString().toFloat());
rect.setHeight(svgHeight.toString().toFloat()); rect.setHeight(svgHeight.toString().toFloat());
rect.translate(-rect.center());
curtainItem->setRect(rect); curtainItem->setRect(rect);

@ -634,18 +634,38 @@ UBBoardView::mouseDoubleClickEvent (QMouseEvent *event)
} }
void void
UBBoardView::wheelEvent (QWheelEvent *event) UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
{ {
if (isInteractive () && event->orientation () == Qt::Vertical) if (isInteractive () && wheelEvent->orientation () == Qt::Vertical)
{ {
// 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 // 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. // and move scroll with one const speed.
// so, you no will related with scroll event count // so, you no will related with scroll event count
} }
// event->accept ();
QGraphicsView::wheelEvent(event); QList<QGraphicsItem *> selItemsList = scene()->selectedItems();
// if NO have selected items, than no need process mouse wheel. just exist
if( selItemsList.count() > 0 )
{
// only one selected item possible, so we will work with first item only
QGraphicsItem * selItem = selItemsList[0];
// get items list under mouse cursor
QPointF scenePos = mapToScene(wheelEvent->pos());
QList<QGraphicsItem *> itemsList = scene()->items(scenePos);
QBool isSlectedAndMouseHower = itemsList.contains(selItem);
if(isSlectedAndMouseHower)
{
wheelEvent->accept();
QGraphicsView::wheelEvent(wheelEvent);
}
}
} }
void void
@ -895,4 +915,3 @@ UBBoardView::setToolCursor (int tool)
} }
} }

@ -195,12 +195,12 @@ bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event)
{ {
if( mDelegated->isSelected() ) if( mDelegated->isSelected() )
{ {
event->accept(); // event->accept();
return true; return true;
} }
else else
{ {
event->ignore(); // event->ignore();
return false; return false;
} }
} }

@ -105,7 +105,10 @@ void UBGraphicsProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void UBGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event) void UBGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event)
{ {
if( mDelegate->weelEvent(event) ) if( mDelegate->weelEvent(event) )
{
QGraphicsProxyWidget::wheelEvent(event); QGraphicsProxyWidget::wheelEvent(event);
event->accept();
}
} }

Loading…
Cancel
Save