SANKORE-852

Draw lines and move
preferencesAboutTextFull
Anatoly Mihalchenko 12 years ago
parent 370e5b37d0
commit a748e8a299
  1. 12
      src/board/UBBoardView.cpp
  2. 2
      src/board/UBBoardView.h
  3. 25
      src/domain/UBGraphicsStrokesGroup.cpp
  4. 3
      src/domain/UBGraphicsStrokesGroup.h

@ -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);

Loading…
Cancel
Save