Fixed behavior of c++ tools.

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent ac215755c3
commit c74c6cdc40
  1. 16
      src/board/UBBoardView.cpp
  2. 1
      src/board/UBBoardView.h
  3. 23
      src/tools/UBGraphicsCompass.cpp

@ -28,6 +28,7 @@
#include "core/UBApplication.h"
#include "core/UBSetting.h"
#include "core/UBPersistenceManager.h"
#include "core/UB.h"
#include "network/UBHttpGet.h"
@ -446,6 +447,16 @@ bool UBBoardView::isUBItem(QGraphicsItem *item)
}
}
bool UBBoardView::isCppTool(QGraphicsItem *item)
{
return (item->type() == UBGraphicsItemType::CompassItemType
|| item->type() == UBGraphicsItemType::RulerItemType
|| item->type() == UBGraphicsItemType::ProtractorItemType
|| item->type() == UBGraphicsItemType::TriangleItemType
|| item->type() == UBGraphicsItemType::AristoItemType
|| item->type() == UBGraphicsItemType::CurtainItemType);
}
void UBBoardView::handleItemsSelection(QGraphicsItem *item)
{
// we need to select new pressed itemOnBoard and deselect all other items.
@ -1137,7 +1148,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
movingItem = NULL;
}
else
if (movingItem)
if (movingItem && !isCppTool(movingItem))
{
if (suspendedMousePressEvent)
{
@ -1153,7 +1164,6 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
DelegateButton::Type != movingItem->type() &&
QGraphicsSvgItem::Type != movingItem->type() &&
UBGraphicsDelegateFrame::Type != movingItem->type() &&
// UBToolWidget::Type != movingItem->type() &&
UBGraphicsCache::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
!(!isMultipleSelectionEnabled() && movingItem->parentItem() && UBGraphicsWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()))
@ -1175,6 +1185,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
}
}
else
bReleaseIsNeed = true;
if (mUBRubberBand && mUBRubberBand->isVisible()) {
mUBRubberBand->hide();

@ -58,6 +58,7 @@ class UBBoardView : public QGraphicsView
bool itemIsLocked(QGraphicsItem *item);
bool isUBItem(QGraphicsItem *item); // we should to determine items who is not UB and use general scene behavior for them.
bool isCppTool(QGraphicsItem *item);
void handleItemsSelection(QGraphicsItem *item);
bool itemShouldReceiveMousePressEvent(QGraphicsItem *item);
bool itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item);

@ -188,20 +188,21 @@ void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event)
UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play)
return;
bool closing = false;
if (resizeButtonRect().contains(event->pos()))
{
mResizing = true;
mCloseSvgItem->setVisible(false);
mRotating = false;
event->accept();
}
else if (hingeRect().contains(event->pos()))
{
mRotating = true;
mResizeSvgItem->setVisible(false);
mCloseSvgItem->setVisible(false);
mResizing = false;
event->accept();
}
else
else if (!closeButtonRect().contains(event->pos()))
{
mDrawing = event->pos().x() > rect().right() - sPencilLength - sPencilBaseLength;
if (mDrawing)
@ -211,12 +212,13 @@ void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event)
scene()->initStroke();
scene()->moveTo(mSceneArcStartPoint);
}
mResizeSvgItem->setVisible(false);
mCloseSvgItem->setVisible(false);
QGraphicsRectItem::mousePressEvent(event);
}
else
closing = true;
mResizeSvgItem->setVisible(mShowButtons && mResizing);
mCloseSvgItem->setVisible(mShowButtons && closing);
}
void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
@ -272,19 +274,16 @@ void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (mResizing)
{
mResizing = false;
event->accept();
}
else if (mRotating)
{
mRotating = false;
updateResizeCursor();
updateDrawCursor();
event->accept();
}
else if (mDrawing)
{
mDrawing = false;
updateResizeCursor();
updateDrawCursor();
event->accept();
@ -300,6 +299,8 @@ void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsRectItem::mouseReleaseEvent(event);
}
mResizing = false;
mDrawing = false;
if (scene())
scene()->setModified(true);

Loading…
Cancel
Save