|
|
@ -100,7 +100,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int p |
|
|
|
mStartLayer = pStartLayer; |
|
|
|
mStartLayer = pStartLayer; |
|
|
|
mEndLayer = pEndLayer; |
|
|
|
mEndLayer = pEndLayer; |
|
|
|
|
|
|
|
|
|
|
|
mFilterZIndex = true;
|
|
|
|
mFilterZIndex = true; |
|
|
|
|
|
|
|
|
|
|
|
mLongPressTimer.setInterval(mLongPressInterval); |
|
|
|
mLongPressTimer.setInterval(mLongPressInterval); |
|
|
|
mLongPressTimer.setSingleShot(true); |
|
|
|
mLongPressTimer.setSingleShot(true); |
|
|
@ -288,7 +288,7 @@ UBBoardView::keyPressEvent (QKeyEvent *event) |
|
|
|
void UBBoardView::keyReleaseEvent(QKeyEvent *event) |
|
|
|
void UBBoardView::keyReleaseEvent(QKeyEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// if (!event->isAccepted ())
|
|
|
|
// if (!event->isAccepted ())
|
|
|
|
{
|
|
|
|
{ |
|
|
|
if (Qt::Key_Shift == event->key() |
|
|
|
if (Qt::Key_Shift == event->key() |
|
|
|
||Qt::Key_Control == event->key()) |
|
|
|
||Qt::Key_Control == event->key()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -430,7 +430,7 @@ bool UBBoardView::itemHaveParentWithType(QGraphicsItem *item, int type) |
|
|
|
|
|
|
|
|
|
|
|
if (type == item->type()) |
|
|
|
if (type == item->type()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
return itemHaveParentWithType(item->parentItem(), type); |
|
|
|
return itemHaveParentWithType(item->parentItem(), type); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -447,7 +447,7 @@ bool UBBoardView::isUBItem(QGraphicsItem *item) |
|
|
|
void UBBoardView::handleItemsSelection(QGraphicsItem *item) |
|
|
|
void UBBoardView::handleItemsSelection(QGraphicsItem *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// we need to select new pressed itemOnBoard and deselect all other items.
|
|
|
|
// we need to select new pressed itemOnBoard and deselect all other items.
|
|
|
|
// the trouble is in:
|
|
|
|
// the trouble is in:
|
|
|
|
// some items can has parents (groupped items or strokes, or strokes in groups).
|
|
|
|
// some items can has parents (groupped items or strokes, or strokes in groups).
|
|
|
|
// some items is already selected and we don't need to reselect them
|
|
|
|
// some items is already selected and we don't need to reselect them
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -458,11 +458,11 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item) |
|
|
|
// item has group as first parent - it is any item or UBGraphicsStrokesGroup.
|
|
|
|
// item has group as first parent - it is any item or UBGraphicsStrokesGroup.
|
|
|
|
if(item->parentItem() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()) |
|
|
|
if(item->parentItem() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// delegate buttons shouldn't selected
|
|
|
|
// delegate buttons shouldn't selected
|
|
|
|
if (DelegateButton::Type == item->type()) |
|
|
|
if (DelegateButton::Type == item->type()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// click on svg items (images on Frame) shouldn't change selection.
|
|
|
|
// click on svg items (images on Frame) shouldn't change selection.
|
|
|
|
if (QGraphicsSvgItem::Type == item->type()) |
|
|
|
if (QGraphicsSvgItem::Type == item->type()) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -470,8 +470,8 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item) |
|
|
|
// Delegate frame shouldn't selected
|
|
|
|
// Delegate frame shouldn't selected
|
|
|
|
if (UBGraphicsDelegateFrame::Type == item->type()) |
|
|
|
if (UBGraphicsDelegateFrame::Type == item->type()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if we need to uwe multiple selection - we shouldn't deselect other items.
|
|
|
|
// if we need to uwe multiple selection - we shouldn't deselect other items.
|
|
|
|
if (!isMultipleSelectionEnabled()) |
|
|
|
if (!isMultipleSelectionEnabled()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -495,8 +495,8 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item) |
|
|
|
bool UBBoardView::itemShouldReceiveMousePressEvent(QGraphicsItem *item) |
|
|
|
bool UBBoardView::itemShouldReceiveMousePressEvent(QGraphicsItem *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Some items should receive mouse press events averytime,
|
|
|
|
Some items should receive mouse press events averytime, |
|
|
|
some items should receive that events when they are selected,
|
|
|
|
some items should receive that events when they are selected, |
|
|
|
some items shouldn't receive mouse press events at mouse press, but should receive them at mouse release (suspended mouse press event) |
|
|
|
some items shouldn't receive mouse press events at mouse press, but should receive them at mouse release (suspended mouse press event) |
|
|
|
|
|
|
|
|
|
|
|
Here we determines cases when items should to get mouse press event at pressing on mouse. |
|
|
|
Here we determines cases when items should to get mouse press event at pressing on mouse. |
|
|
@ -559,9 +559,9 @@ Here we determines cases when items should to get mouse press event at pressing |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
case UBGraphicsWidgetItem::Type: |
|
|
|
case UBGraphicsWidgetItem::Type: |
|
|
|
if (currentTool == UBStylusTool::Selector && item->parentItem() && item->parentItem()->isSelected())
|
|
|
|
if (currentTool == UBStylusTool::Selector && item->parentItem() && item->parentItem()->isSelected()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (currentTool == UBStylusTool::Selector && item->isSelected())
|
|
|
|
if (currentTool == UBStylusTool::Selector && item->isSelected()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (currentTool == UBStylusTool::Play) |
|
|
|
if (currentTool == UBStylusTool::Play) |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -574,7 +574,7 @@ Here we determines cases when items should to get mouse press event at pressing |
|
|
|
|
|
|
|
|
|
|
|
bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item) |
|
|
|
bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!item)
|
|
|
|
if (!item) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (item == scene()->backgroundObject()) |
|
|
|
if (item == scene()->backgroundObject()) |
|
|
@ -594,7 +594,7 @@ bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item) |
|
|
|
if (currentTool == UBStylusTool::Selector && item->isSelected()) |
|
|
|
if (currentTool == UBStylusTool::Selector && item->isSelected()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case DelegateButton::Type: |
|
|
|
case DelegateButton::Type: |
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -606,7 +606,7 @@ bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item) |
|
|
|
|
|
|
|
|
|
|
|
bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) |
|
|
|
bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!item)
|
|
|
|
if (!item) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (item == scene()->backgroundObject()) |
|
|
|
if (item == scene()->backgroundObject()) |
|
|
@ -614,15 +614,15 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) |
|
|
|
|
|
|
|
|
|
|
|
if (!(mMouseButtonIsPressed || mTabletStylusIsPressed)) |
|
|
|
if (!(mMouseButtonIsPressed || mTabletStylusIsPressed)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (movingItem->data(UBGraphicsItemData::ItemLocked).toBool()) |
|
|
|
if (movingItem->data(UBGraphicsItemData::ItemLocked).toBool()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (movingItem->parentItem() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type() && !movingItem->isSelected() && movingItem->parentItem()->isSelected()) |
|
|
|
if (movingItem->parentItem() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type() && !movingItem->isSelected() && movingItem->parentItem()->isSelected()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool();
|
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool(); |
|
|
|
|
|
|
|
|
|
|
|
switch(item->type()) |
|
|
|
switch(item->type()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case UBGraphicsCurtainItem::Type: |
|
|
|
case UBGraphicsCurtainItem::Type: |
|
|
@ -630,7 +630,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
case UBGraphicsWidgetItem::Type: |
|
|
|
case UBGraphicsWidgetItem::Type: |
|
|
|
if(currentTool == UBStylusTool::Selector && item->isSelected())
|
|
|
|
if(currentTool == UBStylusTool::Selector && item->isSelected()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
if(currentTool == UBStylusTool::Play) |
|
|
|
if(currentTool == UBStylusTool::Play) |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -640,7 +640,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item) |
|
|
|
if (item->isSelected()) |
|
|
|
if (item->isSelected()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
|
case UBGraphicsMediaItem::Type: |
|
|
|
case UBGraphicsStrokesGroup::Type:
|
|
|
|
case UBGraphicsStrokesGroup::Type: |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case UBGraphicsTextItem::Type: |
|
|
|
case UBGraphicsTextItem::Type: |
|
|
|
return !item->isSelected(); |
|
|
|
return !item->isSelected(); |
|
|
@ -654,13 +654,13 @@ QGraphicsItem* UBBoardView::determineItemToPress(QGraphicsItem *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(item) |
|
|
|
if(item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool();
|
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool(); |
|
|
|
|
|
|
|
|
|
|
|
// if item is on group and group is not selected - group should take press.
|
|
|
|
// if item is on group and group is not selected - group should take press.
|
|
|
|
if (UBStylusTool::Selector == currentTool
|
|
|
|
if (UBStylusTool::Selector == currentTool |
|
|
|
&& item->parentItem()
|
|
|
|
&& item->parentItem() |
|
|
|
&& UBGraphicsGroupContainerItem::Type == item->parentItem()->type()
|
|
|
|
&& UBGraphicsGroupContainerItem::Type == item->parentItem()->type() |
|
|
|
&& !item->parentItem()->isSelected())
|
|
|
|
&& !item->parentItem()->isSelected()) |
|
|
|
return item->parentItem(); |
|
|
|
return item->parentItem(); |
|
|
|
|
|
|
|
|
|
|
|
// items like polygons placed in two groups nested, so we need to recursive call.
|
|
|
|
// items like polygons placed in two groups nested, so we need to recursive call.
|
|
|
@ -676,7 +676,7 @@ QGraphicsItem* UBBoardView::determineItemToMove(QGraphicsItem *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(item) |
|
|
|
if(item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool();
|
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool(); |
|
|
|
|
|
|
|
|
|
|
|
//W3C widgets should take mouse move events from play tool.
|
|
|
|
//W3C widgets should take mouse move events from play tool.
|
|
|
|
if ((UBStylusTool::Play == currentTool) && (UBGraphicsWidgetItem::Type == item->type())) |
|
|
|
if ((UBStylusTool::Play == currentTool) && (UBGraphicsWidgetItem::Type == item->type())) |
|
|
@ -696,7 +696,7 @@ QGraphicsItem* UBBoardView::determineItemToMove(QGraphicsItem *item) |
|
|
|
// selected groups should be moved by moving any element
|
|
|
|
// selected groups should be moved by moving any element
|
|
|
|
if (item->parentItem()->isSelected()) |
|
|
|
if (item->parentItem()->isSelected()) |
|
|
|
return item; |
|
|
|
return item; |
|
|
|
|
|
|
|
|
|
|
|
if (item->isSelected()) |
|
|
|
if (item->isSelected()) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
@ -704,7 +704,7 @@ QGraphicsItem* UBBoardView::determineItemToMove(QGraphicsItem *item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// items like polygons placed in two groups nested, so we need to recursive call.
|
|
|
|
// items like polygons placed in two groups nested, so we need to recursive call.
|
|
|
|
if(item->parentItem() && UBGraphicsStrokesGroup::Type == item->parentItem()->type())
|
|
|
|
if(item->parentItem() && UBGraphicsStrokesGroup::Type == item->parentItem()->type()) |
|
|
|
return determineItemToMove(item->parentItem()); |
|
|
|
return determineItemToMove(item->parentItem()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -715,7 +715,7 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mLastPressedMousePos = mapToScene(event->pos()); |
|
|
|
mLastPressedMousePos = mapToScene(event->pos()); |
|
|
|
|
|
|
|
|
|
|
|
// Determining item who will take mouse press event
|
|
|
|
// Determining item who will take mouse press event
|
|
|
|
//all other items will be deselected and if all item will be deselected, then
|
|
|
|
//all other items will be deselected and if all item will be deselected, then
|
|
|
|
// wrong item can catch mouse press. because selected items placed on the top
|
|
|
|
// wrong item can catch mouse press. because selected items placed on the top
|
|
|
|
movingItem = determineItemToPress(movingItem); |
|
|
|
movingItem = determineItemToPress(movingItem); |
|
|
@ -738,7 +738,7 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event) |
|
|
|
delete suspendedMousePressEvent; |
|
|
|
delete suspendedMousePressEvent; |
|
|
|
suspendedMousePressEvent = NULL; |
|
|
|
suspendedMousePressEvent = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (itemShouldReceiveSuspendedMousePressEvent(movingItem)) |
|
|
|
if (itemShouldReceiveSuspendedMousePressEvent(movingItem)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
suspendedMousePressEvent = new QMouseEvent(event->type(), event->pos(), event->button(), event->buttons(), event->modifiers()); |
|
|
|
suspendedMousePressEvent = new QMouseEvent(event->type(), event->pos(), event->button(), event->buttons(), event->modifiers()); |
|
|
@ -752,7 +752,7 @@ void UBBoardView::handleItemMouseMove(QMouseEvent *event) |
|
|
|
movingItem = determineItemToMove(movingItem); |
|
|
|
movingItem = determineItemToMove(movingItem); |
|
|
|
|
|
|
|
|
|
|
|
// items should be moved not every mouse move.
|
|
|
|
// items should be moved not every mouse move.
|
|
|
|
if (movingItem && itemShouldBeMoved(movingItem) && (mMouseButtonIsPressed || mTabletStylusIsPressed))
|
|
|
|
if (movingItem && itemShouldBeMoved(movingItem) && (mMouseButtonIsPressed || mTabletStylusIsPressed)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPointF scenePos = mapToScene(event->pos()); |
|
|
|
QPointF scenePos = mapToScene(event->pos()); |
|
|
|
QPointF newPos = movingItem->pos() + scenePos - mLastPressedMousePos; |
|
|
|
QPointF newPos = movingItem->pos() + scenePos - mLastPressedMousePos; |
|
|
@ -761,7 +761,7 @@ void UBBoardView::handleItemMouseMove(QMouseEvent *event) |
|
|
|
mWidgetMoved = true; |
|
|
|
mWidgetMoved = true; |
|
|
|
event->accept(); |
|
|
|
event->accept(); |
|
|
|
} |
|
|
|
} |
|
|
|
else
|
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPointF posBeforeMove; |
|
|
|
QPointF posBeforeMove; |
|
|
|
QPointF posAfterMove; |
|
|
|
QPointF posAfterMove; |
|
|
@ -777,11 +777,10 @@ void UBBoardView::handleItemMouseMove(QMouseEvent *event) |
|
|
|
mWidgetMoved = ((posAfterMove-posBeforeMove).manhattanLength() != 0); |
|
|
|
mWidgetMoved = ((posAfterMove-posBeforeMove).manhattanLength() != 0); |
|
|
|
|
|
|
|
|
|
|
|
// a cludge for terminate moving of w3c widgets.
|
|
|
|
// a cludge for terminate moving of w3c widgets.
|
|
|
|
// in some cases w3c widgets catches mouse move and doesn't sends that events to web page,
|
|
|
|
// in some cases w3c widgets catches mouse move and doesn't sends that events to web page,
|
|
|
|
// at simple - in google map widget - mouse move events doesn't comes to web page from rectangle of wearch bar on bottom right corner of widget.
|
|
|
|
// at simple - in google map widget - mouse move events doesn't comes to web page from rectangle of wearch bar on bottom right corner of widget.
|
|
|
|
if (mWidgetMoved && UBGraphicsW3CWidgetItem::Type == movingItem->type()) |
|
|
|
if (mWidgetMoved && UBGraphicsW3CWidgetItem::Type == movingItem->type()) |
|
|
|
movingItem->setPos(posBeforeMove); |
|
|
|
movingItem->setPos(posBeforeMove); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -801,7 +800,7 @@ void UBBoardView::moveRubberedItems(QPointF movingVector) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRectF invalidateRect = scene()->itemsBoundingRect(); |
|
|
|
QRectF invalidateRect = scene()->itemsBoundingRect(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (QGraphicsItem *item, mRubberedItems)
|
|
|
|
foreach (QGraphicsItem *item, mRubberedItems) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (item->type() == UBGraphicsW3CWidgetItem::Type |
|
|
|
if (item->type() == UBGraphicsW3CWidgetItem::Type |
|
|
@ -810,10 +809,10 @@ void UBBoardView::moveRubberedItems(QPointF movingVector) |
|
|
|
|| item->type() == UBGraphicsSvgItem::Type |
|
|
|
|| item->type() == UBGraphicsSvgItem::Type |
|
|
|
|| item->type() == UBGraphicsTextItem::Type |
|
|
|
|| item->type() == UBGraphicsTextItem::Type |
|
|
|
|| item->type() == UBGraphicsStrokesGroup::Type |
|
|
|
|| item->type() == UBGraphicsStrokesGroup::Type |
|
|
|
|| item->type() == UBGraphicsGroupContainerItem::Type)
|
|
|
|
|| item->type() == UBGraphicsGroupContainerItem::Type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
item->setPos(item->pos()+movingVector);
|
|
|
|
item->setPos(item->pos()+movingVector); |
|
|
|
}
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
scene()->invalidate(invalidateRect); |
|
|
|
scene()->invalidate(invalidateRect); |
|
|
@ -829,7 +828,7 @@ void UBBoardView::longPressEvent() |
|
|
|
UBDrawingController *drawingController = UBDrawingController::drawingController(); |
|
|
|
UBDrawingController *drawingController = UBDrawingController::drawingController(); |
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); |
|
|
|
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disconnect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent())); |
|
|
|
disconnect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent())); |
|
|
|
|
|
|
|
|
|
|
|
if (UBStylusTool::Selector == currentTool) |
|
|
|
if (UBStylusTool::Selector == currentTool) |
|
|
@ -899,7 +898,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) |
|
|
|
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent())); |
|
|
|
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent())); |
|
|
|
if (!movingItem && !mController->cacheIsVisible()) |
|
|
|
if (!movingItem && !mController->cacheIsVisible()) |
|
|
|
mLongPressTimer.start(); |
|
|
|
mLongPressTimer.start(); |
|
|
|
|
|
|
|
|
|
|
|
if (!movingItem) { |
|
|
|
if (!movingItem) { |
|
|
|
// Rubberband selection implementation
|
|
|
|
// Rubberband selection implementation
|
|
|
|
if (!mUBRubberBand) { |
|
|
|
if (!mUBRubberBand) { |
|
|
@ -986,7 +985,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) |
|
|
|
void |
|
|
|
void |
|
|
|
UBBoardView::mouseMoveEvent (QMouseEvent *event) |
|
|
|
UBBoardView::mouseMoveEvent (QMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!mIsDragInProgress && ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()))
|
|
|
|
if(!mIsDragInProgress && ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -1077,14 +1076,14 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!mTabletStylusIsPressed && scene ()) |
|
|
|
if (!mTabletStylusIsPressed && scene ()) |
|
|
|
{
|
|
|
|
{ |
|
|
|
scene ()->inputDeviceMove (mapToScene (UBGeometryUtils::pointConstrainedInRect (event->pos (), rect ())), mMouseButtonIsPressed); |
|
|
|
scene ()->inputDeviceMove (mapToScene (UBGeometryUtils::pointConstrainedInRect (event->pos (), rect ())), mMouseButtonIsPressed); |
|
|
|
} |
|
|
|
} |
|
|
|
event->accept (); |
|
|
|
event->accept (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())
|
|
|
|
if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()) |
|
|
|
mWidgetMoved = true; |
|
|
|
mWidgetMoved = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
@ -1105,9 +1104,9 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) |
|
|
|
mWidgetMoved = false; |
|
|
|
mWidgetMoved = false; |
|
|
|
movingItem = NULL; |
|
|
|
movingItem = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
else
|
|
|
|
else |
|
|
|
if (movingItem) |
|
|
|
if (movingItem) |
|
|
|
{
|
|
|
|
{ |
|
|
|
if (suspendedMousePressEvent) |
|
|
|
if (suspendedMousePressEvent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
|
|
|
|
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
|
|
|
@ -1140,7 +1139,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
movingItem->setSelected(true); |
|
|
|
movingItem->setSelected(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1163,7 +1162,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (suspendedMousePressEvent)
|
|
|
|
if (suspendedMousePressEvent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
|
|
|
|
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
|
|
|
|
movingItem = NULL; |
|
|
|
movingItem = NULL; |
|
|
|