|
|
|
@ -71,6 +71,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent) |
|
|
|
|
, suspendedMousePressEvent(NULL) |
|
|
|
|
, mLongPressInterval(1000) |
|
|
|
|
, mIsDragInProgress(false) |
|
|
|
|
, mMultipleSelectionIsEnabled(false) |
|
|
|
|
{ |
|
|
|
|
init (); |
|
|
|
|
|
|
|
|
@ -86,6 +87,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int p |
|
|
|
|
, suspendedMousePressEvent(NULL) |
|
|
|
|
, mLongPressInterval(1000) |
|
|
|
|
, mIsDragInProgress(false) |
|
|
|
|
, mMultipleSelectionIsEnabled(false) |
|
|
|
|
{ |
|
|
|
|
init (); |
|
|
|
|
|
|
|
|
@ -206,6 +208,11 @@ UBBoardView::keyPressEvent (QKeyEvent *event) |
|
|
|
|
mController->addScene (); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case Qt::Key_Control: |
|
|
|
|
case Qt::Key_Shift: |
|
|
|
|
{ |
|
|
|
|
mMultipleSelectionIsEnabled = true; |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -266,6 +273,21 @@ UBBoardView::keyPressEvent (QKeyEvent *event) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBBoardView::keyReleaseEvent(QKeyEvent *event) |
|
|
|
|
{ |
|
|
|
|
// if (!event->isAccepted ())
|
|
|
|
|
{
|
|
|
|
|
if (Qt::Key_Shift == event->key() |
|
|
|
|
||Qt::Key_Control == event->key()) |
|
|
|
|
{ |
|
|
|
|
mMultipleSelectionIsEnabled = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGraphicsView::keyReleaseEvent(event); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool |
|
|
|
|
UBBoardView::event (QEvent * e) |
|
|
|
|
{ |
|
|
|
@ -576,7 +598,8 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (movingItem && QGraphicsSvgItem::Type != movingItem->type() |
|
|
|
|
&& UBGraphicsDelegateFrame::Type != movingItem->type()) |
|
|
|
|
&& UBGraphicsDelegateFrame::Type != movingItem->type() |
|
|
|
|
&& !mMultipleSelectionIsEnabled) |
|
|
|
|
{ |
|
|
|
|
foreach(QGraphicsItem *item, scene()->selectedItems()) |
|
|
|
|
{ |
|
|
|
@ -587,6 +610,9 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (mMultipleSelectionIsEnabled) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if (itemShouldReceiveMousePressEvent(movingItem)) |
|
|
|
|
QGraphicsView::mousePressEvent (event); |
|
|
|
|
else |
|
|
|
@ -944,6 +970,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) |
|
|
|
|
|
|
|
|
|
if (currentTool == UBStylusTool::Selector) |
|
|
|
|
{ |
|
|
|
|
bool bReleaseIsNeed = true; |
|
|
|
|
if (mWidgetMoved) |
|
|
|
|
{ |
|
|
|
|
mWidgetMoved = false; |
|
|
|
@ -957,13 +984,25 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) |
|
|
|
|
QGraphicsView::mousePressEvent(suspendedMousePressEvent); // suspendedMousePressEvent is deleted by old Qt event loop
|
|
|
|
|
movingItem = NULL; |
|
|
|
|
delete suspendedMousePressEvent; |
|
|
|
|
suspendedMousePressEvent = NULL;
|
|
|
|
|
suspendedMousePressEvent = NULL; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if ( QGraphicsSvgItem::Type != movingItem->type() |
|
|
|
|
&& UBGraphicsDelegateFrame::Type != movingItem->type()) |
|
|
|
|
movingItem->setSelected(true); |
|
|
|
|
{ |
|
|
|
|
bReleaseIsNeed = false; |
|
|
|
|
if (movingItem->isSelected() && mMultipleSelectionIsEnabled) |
|
|
|
|
movingItem->setSelected(false); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (movingItem->isSelected()) |
|
|
|
|
bReleaseIsNeed = true; |
|
|
|
|
|
|
|
|
|
movingItem->setSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -971,7 +1010,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) |
|
|
|
|
mUBRubberBand->hide(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGraphicsView::mouseReleaseEvent (event); |
|
|
|
|
if (bReleaseIsNeed) |
|
|
|
|
{ |
|
|
|
|
qDebug() << "mre"; |
|
|
|
|
QGraphicsView::mouseReleaseEvent (event); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if (currentTool == UBStylusTool::Play) |
|
|
|
|
{ |
|
|
|
|