Commit 9f95f1be authored by Aleksei Kanash's avatar Aleksei Kanash

Fixed Sankore-793.

parent ca3d3edb
...@@ -417,7 +417,7 @@ bool UBBoardView::itemShouldReceiveMousePressEvent(QGraphicsItem *item) ...@@ -417,7 +417,7 @@ bool UBBoardView::itemShouldReceiveMousePressEvent(QGraphicsItem *item)
return true; return true;
if (item == scene()->backgroundObject()) if (item == scene()->backgroundObject())
return true; return false;
if (itemIsLocked(item)) if (itemIsLocked(item))
return false; return false;
...@@ -577,10 +577,17 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event) ...@@ -577,10 +577,17 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
{ {
mLastPressedMousePos = mapToScene(event->pos()); mLastPressedMousePos = mapToScene(event->pos());
foreach (QGraphicsItem *item, scene()->items())
if (movingItem && QGraphicsSvgItem::Type != movingItem->type()
&& UBGraphicsDelegateFrame::Type != movingItem->type())
{ {
if (movingItem != item) foreach(QGraphicsItem *item, scene()->selectedItems())
item->setSelected(false); {
if (item != movingItem)
{
item->setSelected(false);
}
}
} }
if (itemShouldReceiveMousePressEvent(movingItem)) if (itemShouldReceiveMousePressEvent(movingItem))
...@@ -710,7 +717,9 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) ...@@ -710,7 +717,9 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mMouseDownPos = event->pos (); mMouseDownPos = event->pos ();
emit clickOnBoard(); movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
if (!movingItem)
emit clickOnBoard();
if (event->button () == Qt::LeftButton && isInteractive ()) if (event->button () == Qt::LeftButton && isInteractive ())
{ {
...@@ -738,8 +747,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) ...@@ -738,8 +747,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
} }
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play) else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{ {
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
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();
...@@ -1004,6 +1011,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) ...@@ -1004,6 +1011,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
UBDrawingController::drawingController ()->setStylusTool (UBStylusTool::Selector); UBDrawingController::drawingController ()->setStylusTool (UBStylusTool::Selector);
textItem->setSelected (true); textItem->setSelected (true);
textItem->setFocus();
} }
else else
{ {
......
...@@ -1593,12 +1593,14 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c ...@@ -1593,12 +1593,14 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c
if(!textItem){ if(!textItem){
textItem = addTextWithFont(pString,QPointF(0,0) ,72,UBSettings::settings()->fontFamily(),true,false); textItem = addTextWithFont(pString,QPointF(0,0) ,72,UBSettings::settings()->fontFamily(),true,false);
textItem->setObjectName(objectName); textItem->setObjectName(objectName);
QSizeF size = textItem->size();
textItem->setPos(QPointF(-size.width()/2.0,-size.height()/2.0));
} }
textItem->setPlainText(pString); textItem->setPlainText(pString);
textItem->adjustSize(); textItem->adjustSize();
QSizeF size = textItem->size(); textItem->clearFocus();
textItem->setPos(QPointF(-size.width()/2.0,-size.height()/2.0)); textItem->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
return textItem; return textItem;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment