|
|
@ -58,6 +58,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent) |
|
|
|
, mIsCreatingTextZone (false) |
|
|
|
, mIsCreatingTextZone (false) |
|
|
|
, mIsCreatingSceneGrabZone (false) |
|
|
|
, mIsCreatingSceneGrabZone (false) |
|
|
|
, mOkOnWidget(false) |
|
|
|
, mOkOnWidget(false) |
|
|
|
|
|
|
|
, suspendedMousePressEvent(NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
init (); |
|
|
|
init (); |
|
|
|
|
|
|
|
|
|
|
@ -67,6 +68,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent) |
|
|
|
UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent) |
|
|
|
UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent) |
|
|
|
: QGraphicsView (pParent) |
|
|
|
: QGraphicsView (pParent) |
|
|
|
, mController (pController) |
|
|
|
, mController (pController) |
|
|
|
|
|
|
|
, suspendedMousePressEvent(NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
init (); |
|
|
|
init (); |
|
|
|
|
|
|
|
|
|
|
@ -78,6 +80,8 @@ UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int p |
|
|
|
|
|
|
|
|
|
|
|
UBBoardView::~UBBoardView () { |
|
|
|
UBBoardView::~UBBoardView () { |
|
|
|
//NOOP
|
|
|
|
//NOOP
|
|
|
|
|
|
|
|
if (suspendedMousePressEvent) |
|
|
|
|
|
|
|
delete suspendedMousePressEvent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
@ -116,6 +120,9 @@ UBBoardView::init () |
|
|
|
settingChanged (QVariant ()); |
|
|
|
settingChanged (QVariant ()); |
|
|
|
|
|
|
|
|
|
|
|
unsetCursor(); |
|
|
|
unsetCursor(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
movingItem = NULL; |
|
|
|
|
|
|
|
mWidgetMoved = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsScene* |
|
|
|
UBGraphicsScene* |
|
|
@ -410,7 +417,28 @@ UBBoardView::mousePressEvent (QMouseEvent *event) |
|
|
|
} |
|
|
|
} |
|
|
|
else if (currentTool == UBStylusTool::Selector) |
|
|
|
else if (currentTool == UBStylusTool::Selector) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsView::mousePressEvent (event); |
|
|
|
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!movingItem ||
|
|
|
|
|
|
|
|
movingItem->isSelected() ||
|
|
|
|
|
|
|
|
(movingItem->type() == UBGraphicsDelegateFrame::Type ||
|
|
|
|
|
|
|
|
movingItem->type() == DelegateButton::Type)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
movingItem = NULL; |
|
|
|
|
|
|
|
QGraphicsView::mousePressEvent (event); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mLastPressedMousePos = mapToScene(event->pos()); |
|
|
|
|
|
|
|
if (suspendedMousePressEvent) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete suspendedMousePressEvent; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
suspendedMousePressEvent = new QMouseEvent(event->type(), event->pos(), event->button(), event->buttons(), event->modifiers()); // óäàëèòü
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
event->accept(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (currentTool == UBStylusTool::Text) |
|
|
|
else if (currentTool == UBStylusTool::Text) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -496,7 +524,20 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) |
|
|
|
} |
|
|
|
} |
|
|
|
else if (currentTool == UBStylusTool::Selector) |
|
|
|
else if (currentTool == UBStylusTool::Selector) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsView::mouseMoveEvent (event); |
|
|
|
if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QPointF scenePos = mapToScene(event->pos()); |
|
|
|
|
|
|
|
QPointF newPos = movingItem->pos() + scenePos - mLastPressedMousePos; |
|
|
|
|
|
|
|
movingItem->setPos(newPos); |
|
|
|
|
|
|
|
mLastPressedMousePos = scenePos; |
|
|
|
|
|
|
|
mWidgetMoved = true; |
|
|
|
|
|
|
|
event->accept(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else QGraphicsView::mouseMoveEvent (event); |
|
|
|
} |
|
|
|
} |
|
|
|
else if ((UBDrawingController::drawingController()->isDrawingTool()) |
|
|
|
else if ((UBDrawingController::drawingController()->isDrawingTool()) |
|
|
|
&& !mMouseButtonIsPressed) |
|
|
|
&& !mMouseButtonIsPressed) |
|
|
@ -539,6 +580,19 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
if (currentTool == UBStylusTool::Selector) |
|
|
|
if (currentTool == UBStylusTool::Selector) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (mWidgetMoved) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mWidgetMoved = false; |
|
|
|
|
|
|
|
movingItem = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (movingItem && suspendedMousePressEvent)
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
|
|
|
|
|
|
|
|
movingItem = NULL; |
|
|
|
|
|
|
|
delete suspendedMousePressEvent; |
|
|
|
|
|
|
|
suspendedMousePressEvent = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QGraphicsView::mouseReleaseEvent (event); |
|
|
|
QGraphicsView::mouseReleaseEvent (event); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (currentTool == UBStylusTool::Text) |
|
|
|
else if (currentTool == UBStylusTool::Text) |
|
|
|