@ -91,7 +91,6 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
, mMultipleSelectionIsEnabled ( false )
, mMultipleSelectionIsEnabled ( false )
, bIsControl ( isControl )
, bIsControl ( isControl )
, bIsDesktop ( isDesktop )
, bIsDesktop ( isDesktop )
, mRubberBandInPlayMode ( false ) //enables rubberband with play tool
{
{
init ( ) ;
init ( ) ;
@ -535,12 +534,7 @@ 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 :
case QGraphicsSvgItem : : Type :
return true ;
case DelegateButton : : Type :
case DelegateButton : : Type :
return true ;
return true ;
@ -989,10 +983,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if ( ! movingItem & & ! mController - > cacheIsVisible ( ) )
if ( ! movingItem & & ! mController - > cacheIsVisible ( ) )
mLongPressTimer . start ( ) ;
mLongPressTimer . start ( ) ;
if ( mUBRubberBand ) {
mUBRubberBand - > hide ( ) ;
}
handleItemMousePress ( event ) ;
handleItemMousePress ( event ) ;
event - > accept ( ) ;
event - > accept ( ) ;
break ;
break ;
@ -1006,9 +996,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
QListIterator < QGraphicsItem * > it ( scene ( ) - > items ( fuzzyRect ) ) ;
QListIterator < QGraphicsItem * > it ( scene ( ) - > items ( fuzzyRect ) ) ;
while ( it . hasNext ( ) & & ! foundTextItem )
while ( it . hasNext ( ) & & ! foundTextItem )
{
foundTextItem = qgraphicsitem_cast < UBGraphicsTextItem * > ( it . next ( ) ) ;
foundTextItem = qgraphicsitem_cast < UBGraphicsTextItem * > ( it . next ( ) ) ;
}
if ( foundTextItem )
if ( foundTextItem )
{
{
@ -1091,7 +1079,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
switch ( currentTool ) {
switch ( currentTool ) {
case UBStylusTool : : Hand : {
case UBStylusTool : : Hand : {
if ( ! mMouseButtonIsPressed & & mTabletStylusIsPressed ) {
if ( ! mMouseButtonIsPressed & & ! mTabletStylusIsPressed ) {
break ;
break ;
}
}
QPointF eventPosition = event - > posF ( ) ;
QPointF eventPosition = event - > posF ( ) ;
@ -1109,7 +1097,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
return ;
return ;
}
}
bool rubberMove = currentTool ! = ( UBStylusTool : : Play | | mRubberBandInPlayMode )
bool rubberMove = ( currentTool ! = ( UBStylusTool : : Play ) )
& & ( mMouseButtonIsPressed | | mTabletStylusIsPressed )
& & ( mMouseButtonIsPressed | | mTabletStylusIsPressed )
& & ! movingItem ;
& & ! movingItem ;
@ -1172,13 +1160,13 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
case UBStylusTool : : Text :
case UBStylusTool : : Text :
case UBStylusTool : : Capture : {
case UBStylusTool : : Capture : {
if ( mRubberBand
if ( mRubberBand & & ( mIsCreatingTextZone | | mIsCreatingSceneGrabZone ) ) {
& & ( mIsCreatingTextZone | | mIsCreatingSceneGrabZone ) ) {
mRubberBand - > setGeometry ( QRect ( mMouseDownPos , event - > pos ( ) ) . normalized ( ) ) ;
mRubberBand - > setGeometry ( QRect ( mMouseDownPos , event - > pos ( ) ) . normalized ( ) ) ;
event - > accept ( ) ;
event - > accept ( ) ;
} else {
QGraphicsView : : mouseMoveEvent ( event ) ;
}
}
else
QGraphicsView : : mouseMoveEvent ( event ) ;
} break ;
} break ;
default :
default :
@ -1240,7 +1228,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
{
if ( isUBItem ( movingItem ) & &
if ( isUBItem ( movingItem ) & &
DelegateButton : : Type ! = movingItem - > type ( ) & &
DelegateButton : : Type ! = movingItem - > type ( ) & &
QGraphicsSvgItem : : Type ! = movingItem - > type ( ) & &
UBGraphicsDelegateFrame : : Type ! = movingItem - > type ( ) & &
UBGraphicsDelegateFrame : : Type ! = movingItem - > type ( ) & &
UBGraphicsCache : : Type ! = movingItem - > type ( ) & &
UBGraphicsCache : : Type ! = movingItem - > type ( ) & &
QGraphicsWebView : : Type ! = movingItem - > type ( ) & & // for W3C widgets as Tools.
QGraphicsWebView : : Type ! = movingItem - > type ( ) & & // for W3C widgets as Tools.
@ -1257,7 +1244,14 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if ( movingItem - > isSelected ( ) )
if ( movingItem - > isSelected ( ) )
bReleaseIsNeed = true ;
bReleaseIsNeed = true ;
movingItem - > setSelected ( true ) ;
UBGraphicsTextItem * textItem = dynamic_cast < UBGraphicsTextItem * > ( movingItem ) ;
UBGraphicsMediaItem * movieItem = dynamic_cast < UBGraphicsMediaItem * > ( movingItem ) ;
if ( textItem )
textItem - > setSelected ( true ) ;
else if ( movieItem )
movieItem - > setSelected ( true ) ;
else
movingItem - > setSelected ( true ) ;
}
}
}
}
@ -1266,10 +1260,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
else
else
bReleaseIsNeed = true ;
bReleaseIsNeed = true ;
if ( mUBRubberBand & & mUBRubberBand - > isVisible ( ) ) {
mUBRubberBand - > hide ( ) ;
}
if ( bReleaseIsNeed )
if ( bReleaseIsNeed )
{
{
QGraphicsView : : mouseReleaseEvent ( event ) ;
QGraphicsView : : mouseReleaseEvent ( event ) ;
@ -1297,6 +1287,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
suspendedMousePressEvent = NULL ;
suspendedMousePressEvent = NULL ;
}
}
}
}
QGraphicsView : : mouseReleaseEvent ( event ) ;
QGraphicsView : : mouseReleaseEvent ( event ) ;
}
}
else if ( currentTool = = UBStylusTool : : Text )
else if ( currentTool = = UBStylusTool : : Text )
@ -1368,10 +1359,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
else
else
bReleaseIsNeed = true ;
bReleaseIsNeed = true ;
if ( mUBRubberBand & & mUBRubberBand - > isVisible ( ) ) {
mUBRubberBand - > hide ( ) ;
}
if ( bReleaseIsNeed )
if ( bReleaseIsNeed )
{
{
QGraphicsView : : mouseReleaseEvent ( event ) ;
QGraphicsView : : mouseReleaseEvent ( event ) ;
@ -1399,8 +1386,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
}
else if ( currentTool = = UBStylusTool : : Capture )
else if ( currentTool = = UBStylusTool : : Capture )
{
{
if ( mRubberBand )
mRubberBand - > hide ( ) ;
if ( scene ( ) & & mRubberBand & & mIsCreatingSceneGrabZone & & mRubberBand - > geometry ( ) . width ( ) > 16 )
if ( scene ( ) & & mRubberBand & & mIsCreatingSceneGrabZone & & mRubberBand - > geometry ( ) . width ( ) > 16 )
{
{
@ -1428,6 +1413,19 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
}
}
}
if ( mUBRubberBand ) {
mUBRubberBand - > hide ( ) ;
delete mUBRubberBand ;
mUBRubberBand = NULL ;
}
if ( mRubberBand ) {
mRubberBand - > hide ( ) ;
delete mRubberBand ;
mRubberBand = NULL ;
}
mMouseButtonIsPressed = false ;
mMouseButtonIsPressed = false ;
mPendingStylusReleaseEvent = false ;
mPendingStylusReleaseEvent = false ;
mTabletStylusIsPressed = false ;
mTabletStylusIsPressed = false ;