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 ()); settingChanged (QVariant ());
unsetCursor();
} }
UBGraphicsScene* UBGraphicsScene*

@ -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);

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

Loading…
Cancel
Save