@ -117,6 +117,7 @@ UBBoardView::init ()
mUsingTabletEraser = false ;
mUsingTabletEraser = false ;
mIsCreatingTextZone = false ;
mIsCreatingTextZone = false ;
mRubberBand = 0 ;
mRubberBand = 0 ;
mUBRubberBand = 0 ;
mVirtualKeyboardActive = false ;
mVirtualKeyboardActive = false ;
@ -414,10 +415,19 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
}
}
else if ( currentTool = = UBStylusTool : : Selector )
else if ( currentTool = = UBStylusTool : : Selector )
{
{
QSet < QGraphicsItem * > existingTools = scene ( ) - > tools ( ) ;
// QSet<QGraphicsItem*> existingTools = scene()->tools(); why do we need to get tools here?
movingItem = scene ( ) - > itemAt ( this - > mapToScene ( event - > posF ( ) . toPoint ( ) ) ) ;
movingItem = scene ( ) - > itemAt ( this - > mapToScene ( event - > posF ( ) . toPoint ( ) ) ) ;
if ( ! movingItem ) {
// Rubberband selection implementation
if ( ! mUBRubberBand ) {
mUBRubberBand = new UBRubberBand ( QRubberBand : : Rectangle , this ) ;
}
mUBRubberBand - > setGeometry ( QRect ( mMouseDownPos , QSize ( ) ) ) ;
mUBRubberBand - > show ( ) ;
}
if ( ! movingItem
if ( ! movingItem
| | movingItem - > isSelected ( )
| | movingItem - > isSelected ( )
| | movingItem - > type ( ) = = UBGraphicsDelegateFrame : : Type
| | movingItem - > type ( ) = = UBGraphicsDelegateFrame : : Type
@ -443,6 +453,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
suspendedMousePressEvent = new QMouseEvent ( event - > type ( ) , event - > pos ( ) , event - > button ( ) , event - > buttons ( ) , event - > modifiers ( ) ) ; // удалить
suspendedMousePressEvent = new QMouseEvent ( event - > type ( ) , event - > pos ( ) , event - > button ( ) , event - > buttons ( ) , event - > modifiers ( ) ) ; // удалить
}
}
event - > accept ( ) ;
event - > accept ( ) ;
}
}
else if ( currentTool = = UBStylusTool : : Text )
else if ( currentTool = = UBStylusTool : : Text )
@ -470,7 +481,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if ( ! mRubberBand )
if ( ! mRubberBand )
mRubberBand = new UBRubberBand ( QRubberBand : : Rectangle , this ) ;
mRubberBand = new UBRubberBand ( QRubberBand : : Rectangle , this ) ;
mRubberBand - > setGeometry ( QRect ( mMouseDownPos , QSize ( ) ) ) ;
mRubberBand - > setGeometry ( QRect ( mMouseDownPos , QSize ( ) ) ) ;
mRubberBand - > show ( ) ;
mRubberBand - > show ( ) ;
mIsCreatingTextZone = true ;
mIsCreatingTextZone = true ;
@ -533,6 +543,10 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
return ;
return ;
}
}
if ( mUBRubberBand & & mUBRubberBand - > isVisible ( ) ) {
mUBRubberBand - > setGeometry ( QRect ( mMouseDownPos , event - > pos ( ) ) . normalized ( ) ) ;
}
if ( movingItem & & ( mMouseButtonIsPressed | | mTabletStylusIsPressed ) )
if ( movingItem & & ( mMouseButtonIsPressed | | mTabletStylusIsPressed ) )
{
{
QPointF scenePos = mapToScene ( event - > pos ( ) ) ;
QPointF scenePos = mapToScene ( event - > pos ( ) ) ;
@ -598,6 +612,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
suspendedMousePressEvent = NULL ;
suspendedMousePressEvent = NULL ;
}
}
if ( mUBRubberBand & & mUBRubberBand - > isVisible ( ) ) {
mUBRubberBand - > hide ( ) ;
}
QGraphicsView : : mouseReleaseEvent ( event ) ;
QGraphicsView : : mouseReleaseEvent ( event ) ;
}
}
else if ( currentTool = = UBStylusTool : : Text )
else if ( currentTool = = UBStylusTool : : Text )