Cursor problem fixed

preferencesAboutTextFull
Anatoly Mihalchenko 14 years ago
parent 3d8deb8c13
commit 66a4bf0273
  1. 1
      src/board/UBBoardView.cpp
  2. 22
      src/tools/UBGraphicsCompass.cpp
  3. 9
      src/tools/UBGraphicsProtractor.cpp

@ -101,6 +101,7 @@ UBBoardView::init ()
settingChanged (QVariant ());
unsetCursor();
}
UBGraphicsScene*

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

@ -11,6 +11,7 @@
#include "gui/UBResources.h"
#include "domain/UBGraphicsScene.h"
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
const int UBGraphicsProtractor::sFillTransparency = 127;
@ -263,6 +264,9 @@ void UBGraphicsProtractor::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void UBGraphicsProtractor::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector)
return;
if (!mShowButtons)
{
mShowButtons = true;
@ -283,7 +287,7 @@ void UBGraphicsProtractor::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void UBGraphicsProtractor::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
mShowButtons = false;
setCursor(Qt::ArrowCursor);
unsetCursor();
update();
event->accept();
}
@ -291,6 +295,9 @@ void UBGraphicsProtractor::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void UBGraphicsProtractor::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector)
return;
Tool currentTool = toolFromPos(event->pos());
if (!mShowButtons)

Loading…
Cancel
Save