|
|
@ -349,18 +349,17 @@ void UBBoardView::tabletEvent (QTabletEvent * event) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if event are not Pen events, we drop the tablet stuff and route everything through mouse event
|
|
|
|
|
|
|
|
if (currentTool != UBStylusTool::Pen && currentTool != UBStylusTool::Line && currentTool != UBStylusTool::Marker && !mMarkerPressureSensitive){ |
|
|
|
|
|
|
|
event->setAccepted (false); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QPointF scenePos = viewportTransform ().inverted ().map (tabletPos); |
|
|
|
QPointF scenePos = viewportTransform ().inverted ().map (tabletPos); |
|
|
|
|
|
|
|
|
|
|
|
qreal pressure = 1.0; |
|
|
|
qreal pressure = 1.0; |
|
|
|
if (((currentTool == UBStylusTool::Pen || currentTool == UBStylusTool::Line) && mPenPressureSensitive) || (currentTool == UBStylusTool::Marker && mMarkerPressureSensitive)) |
|
|
|
if (((currentTool == UBStylusTool::Pen || currentTool == UBStylusTool::Line) && mPenPressureSensitive) || |
|
|
|
|
|
|
|
(currentTool == UBStylusTool::Marker && mMarkerPressureSensitive)) |
|
|
|
pressure = event->pressure (); |
|
|
|
pressure = event->pressure (); |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
//Explanation: rerouting to mouse event
|
|
|
|
|
|
|
|
event->setAccepted (false); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool acceptEvent = true; |
|
|
|
bool acceptEvent = true; |
|
|
|
#ifdef Q_WS_MAC |
|
|
|
#ifdef Q_WS_MAC |
|
|
@ -534,18 +533,28 @@ Here we determines cases when items should to get mouse press event at pressing |
|
|
|
case UBGraphicsTriangle::Type: |
|
|
|
case UBGraphicsTriangle::Type: |
|
|
|
case UBGraphicsCompass::Type: |
|
|
|
case UBGraphicsCompass::Type: |
|
|
|
case UBGraphicsCache::Type: |
|
|
|
case UBGraphicsCache::Type: |
|
|
|
|
|
|
|
return true; |
|
|
|
case UBGraphicsDelegateFrame::Type: |
|
|
|
case UBGraphicsDelegateFrame::Type: |
|
|
|
|
|
|
|
if (currentTool == UBStylusTool::Play) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
case UBGraphicsPixmapItem::Type: |
|
|
|
|
|
|
|
case UBGraphicsSvgItem::Type: |
|
|
|
|
|
|
|
if (currentTool == UBStylusTool::Play) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
if (item->isSelected()) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return false; |
|
|
|
case DelegateButton::Type: |
|
|
|
case DelegateButton::Type: |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
case UBGraphicsSvgItem::Type: |
|
|
|
|
|
|
|
case UBGraphicsPixmapItem::Type: |
|
|
|
|
|
|
|
case UBGraphicsTextItem::Type: |
|
|
|
case UBGraphicsTextItem::Type: |
|
|
|
if (currentTool == UBStylusTool::Play) |
|
|
|
if (currentTool == UBStylusTool::Play) |
|
|
|
return false; |
|
|
|
return true; |
|
|
|
if ((currentTool == UBStylusTool::Selector) && item->isSelected()) |
|
|
|
if ((currentTool == UBStylusTool::Selector) && item->isSelected()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if ((currentTool == UBStylusTool::Selector) && item->parentItem() && item->parentItem()->isSelected()) |
|
|
|
if ((currentTool == UBStylusTool::Selector) && item->parentItem() && item->parentItem()->isSelected()) |
|
|
@ -553,8 +562,13 @@ Here we determines cases when items should to get mouse press event at pressing |
|
|
|
if (currentTool != UBStylusTool::Selector) |
|
|
|
if (currentTool != UBStylusTool::Selector) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case UBGraphicsGroupContainerItem::Type: |
|
|
|
|
|
|
|
|
|
|
|
case UBGraphicsItemType::StrokeItemType: |
|
|
|
|
|
|
|
if (currentTool == UBStylusTool::Play) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
break; |
|
|
|
// Groups shouldn't reacts on any presses and moves for Play tool.
|
|
|
|
// Groups shouldn't reacts on any presses and moves for Play tool.
|
|
|
|
|
|
|
|
case UBGraphicsGroupContainerItem::Type: |
|
|
|
if(currentTool == UBStylusTool::Play) |
|
|
|
if(currentTool == UBStylusTool::Play) |
|
|
|
{ |
|
|
|
{ |
|
|
|
movingItem = NULL; |
|
|
|
movingItem = NULL; |
|
|
@ -594,6 +608,7 @@ bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item) |
|
|
|
case QGraphicsWebView::Type: |
|
|
|
case QGraphicsWebView::Type: |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
case UBGraphicsPixmapItem::Type: |
|
|
|
case UBGraphicsPixmapItem::Type: |
|
|
|
|
|
|
|
case UBGraphicsSvgItem::Type: |
|
|
|
case UBGraphicsTextItem::Type: |
|
|
|
case UBGraphicsTextItem::Type: |
|
|
|
case UBGraphicsWidgetItem::Type: |
|
|
|
case UBGraphicsWidgetItem::Type: |
|
|
|
if (currentTool == UBStylusTool::Selector && !item->isSelected() && item->parentItem()) |
|
|
|
if (currentTool == UBStylusTool::Selector && !item->isSelected() && item->parentItem()) |
|
|
@ -644,6 +659,8 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) |
|
|
|
|
|
|
|
|
|
|
|
case UBGraphicsSvgItem::Type: |
|
|
|
case UBGraphicsSvgItem::Type: |
|
|
|
case UBGraphicsPixmapItem::Type: |
|
|
|
case UBGraphicsPixmapItem::Type: |
|
|
|
|
|
|
|
if (currentTool == UBStylusTool::Play || !item->isSelected()) |
|
|
|
|
|
|
|
return true; |
|
|
|
if (item->isSelected()) |
|
|
|
if (item->isSelected()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
@ -943,9 +960,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) |
|
|
|
mMouseDownPos = event->pos (); |
|
|
|
mMouseDownPos = event->pos (); |
|
|
|
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); |
|
|
|
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); |
|
|
|
|
|
|
|
|
|
|
|
if (!movingItem) |
|
|
|
|
|
|
|
emit clickOnBoard(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (event->button () == Qt::LeftButton && isInteractive()) |
|
|
|
if (event->button () == Qt::LeftButton && isInteractive()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); |
|
|
|
int currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); |
|
|
|