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