SANKORE-97 Delete an object with keyboard

SANKORE-477 	Erasing an object with the keyboard
preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 278fa7da07
commit 2c70158153
  1. 19
      src/board/UBBoardView.cpp
  2. 3
      src/domain/UBGraphicsScene.cpp

@ -481,9 +481,9 @@ bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item)
case UBGraphicsPixmapItem::Type: case UBGraphicsPixmapItem::Type:
case UBGraphicsTextItem::Type: case UBGraphicsTextItem::Type:
case UBGraphicsW3CWidgetItem::Type: case UBGraphicsW3CWidgetItem::Type:
if (currentTool != UBStylusTool::Play && !item->isSelected() && item->parentItem()) if (currentTool == UBStylusTool::Selector && !item->isSelected() && item->parentItem())
return true; return true;
if (currentTool != UBStylusTool::Play && !item->isSelected()) if (currentTool == UBStylusTool::Selector && item->isSelected())
return true; return true;
break; break;
@ -580,12 +580,21 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
if (itemShouldReceiveMousePressEvent(movingItem)) if (itemShouldReceiveMousePressEvent(movingItem))
QGraphicsView::mousePressEvent (event); QGraphicsView::mousePressEvent (event);
else else
if (itemShouldReceiveSuspendedMousePressEvent(movingItem))
{ {
if (movingItem)
movingItem->clearFocus();
if (suspendedMousePressEvent) if (suspendedMousePressEvent)
{
delete suspendedMousePressEvent; delete suspendedMousePressEvent;
suspendedMousePressEvent = NULL;
}
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());
} }
}
} }
void UBBoardView::handleItemMouseMove(QMouseEvent *event) void UBBoardView::handleItemMouseMove(QMouseEvent *event)
@ -933,6 +942,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
delete suspendedMousePressEvent; delete suspendedMousePressEvent;
suspendedMousePressEvent = NULL; suspendedMousePressEvent = NULL;
} }
else
{
movingItem->setSelected(true);
}
} }
if (mUBRubberBand && mUBRubberBand->isVisible()) { if (mUBRubberBand && mUBRubberBand->isVisible()) {

@ -43,6 +43,7 @@
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBDrawingController.h" #include "board/UBDrawingController.h"
#include "board/UBBoardView.h"
#include "UBGraphicsItemUndoCommand.h" #include "UBGraphicsItemUndoCommand.h"
#include "UBGraphicsTextItemUndoCommand.h" #include "UBGraphicsTextItemUndoCommand.h"
@ -1453,6 +1454,8 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
{ {
UBApplication::boardController->moveGraphicsWidgetToControlView(graphicsWidget); UBApplication::boardController->moveGraphicsWidgetToControlView(graphicsWidget);
} }
UBApplication::boardController->controlView()->setFocus();
} }
UBGraphicsW3CWidgetItem* UBGraphicsScene::addOEmbed(const QUrl& pContentUrl, const QPointF& pPos) UBGraphicsW3CWidgetItem* UBGraphicsScene::addOEmbed(const QUrl& pContentUrl, const QPointF& pPos)

Loading…
Cancel
Save