Commit a748e8a2 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

SANKORE-852

 Draw lines and move
parent 370e5b37
......@@ -596,7 +596,7 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
mLastPressedMousePos = mapToScene(event->pos());
if (movingItem && QGraphicsSvgItem::Type != movingItem->type()
if (movingItem && !hasSelectedParents(movingItem) && QGraphicsSvgItem::Type != movingItem->type()
&& UBGraphicsDelegateFrame::Type != movingItem->type()
&& !mMultipleSelectionIsEnabled)
{
......@@ -1405,3 +1405,13 @@ UBBoardView::setToolCursor (int tool)
controlViewport->setCursor (UBResources::resources ()->penCursor);
}
}
bool UBBoardView::hasSelectedParents(QGraphicsItem * item)
{
if (item->isSelected())
return true;
if (item->parentItem()==NULL)
return false;
return hasSelectedParents(item->parentItem());
}
......@@ -148,6 +148,8 @@ class UBBoardView : public QGraphicsView
bool mIsDragInProgress;
bool mMultipleSelectionIsEnabled;
static bool hasSelectedParents(QGraphicsItem * item);
private slots:
void settingChanged(QVariant newValue);
......
......@@ -112,6 +112,31 @@ void UBGraphicsStrokesGroup::paint(QPainter *painter, const QStyleOptionGraphics
QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVariant &value)
{
if (change == QGraphicsItem::ItemSelectedChange)
{
int a = 13;
}
QVariant newValue = mDelegate->itemChange(change, value);
return QGraphicsItemGroup::itemChange(change, newValue);
}
QPainterPath UBGraphicsStrokesGroup::shape () const
{
QPainterPath path;
if (isSelected())
{
path.addRect(boundingRect());
}
else
{
foreach(QGraphicsItem* item, childItems())
{
path.addPath(item->shape());
}
}
return path;
}
......@@ -25,6 +25,9 @@ public:
virtual void setUuid(const QUuid &pUuid);
protected:
virtual QPainterPath shape () const;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
......
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