|
|
@ -59,6 +59,8 @@ UBGraphicsCompass::UBGraphicsCompass() |
|
|
|
updateResizeCursor(); |
|
|
|
updateResizeCursor(); |
|
|
|
updateDrawCursor(); |
|
|
|
updateDrawCursor(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsetCursor(); |
|
|
|
|
|
|
|
|
|
|
|
connect(UBApplication::boardController, SIGNAL(penColorChanged()), this, SLOT(penColorChanged())); |
|
|
|
connect(UBApplication::boardController, SIGNAL(penColorChanged()), this, SLOT(penColorChanged())); |
|
|
|
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(lineWidthChanged())); |
|
|
|
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(lineWidthChanged())); |
|
|
|
} |
|
|
|
} |
|
|
@ -157,6 +159,9 @@ QVariant UBGraphicsCompass::itemChange(GraphicsItemChange change, const QVariant |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (resizeButtonRect().contains(event->pos())) |
|
|
|
if (resizeButtonRect().contains(event->pos())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mResizing = true; |
|
|
|
mResizing = true; |
|
|
@ -189,6 +194,9 @@ void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!mResizing && !mRotating && !mDrawing) |
|
|
|
if (!mResizing && !mRotating && !mDrawing) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsRectItem::mouseMoveEvent(event); |
|
|
|
QGraphicsRectItem::mouseMoveEvent(event); |
|
|
@ -230,6 +238,9 @@ void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (mResizing) |
|
|
|
if (mResizing) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mResizing = false; |
|
|
|
mResizing = false; |
|
|
@ -267,6 +278,9 @@ void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event) |
|
|
|
void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
mOuterCursor = cursor(); |
|
|
|
mOuterCursor = cursor(); |
|
|
|
mShowButtons = shape().contains(event->pos()); |
|
|
|
mShowButtons = shape().contains(event->pos()); |
|
|
|
|
|
|
|
|
|
|
@ -293,16 +307,22 @@ void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsCompass::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) |
|
|
|
void UBGraphicsCompass::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
mShowButtons = false; |
|
|
|
mShowButtons = false; |
|
|
|
mCloseSvgItem->setVisible(mShowButtons); |
|
|
|
mCloseSvgItem->setVisible(mShowButtons); |
|
|
|
mResizeSvgItem->setVisible(mShowButtons); |
|
|
|
mResizeSvgItem->setVisible(mShowButtons); |
|
|
|
setCursor(mOuterCursor); |
|
|
|
unsetCursor(); |
|
|
|
event->accept(); |
|
|
|
event->accept(); |
|
|
|
update(); |
|
|
|
update(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsCompass::hoverMoveEvent(QGraphicsSceneHoverEvent *event) |
|
|
|
void UBGraphicsCompass::hoverMoveEvent(QGraphicsSceneHoverEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
mShowButtons = shape().contains(event->pos()); |
|
|
|
mShowButtons = shape().contains(event->pos()); |
|
|
|
mCloseSvgItem->setVisible(mShowButtons); |
|
|
|
mCloseSvgItem->setVisible(mShowButtons); |
|
|
|
mResizeSvgItem->setVisible(mShowButtons); |
|
|
|
mResizeSvgItem->setVisible(mShowButtons); |
|
|
|