fix Delegate item

new_vector_item
thomas_lucky13 2 years ago
parent c24904f800
commit fd4852c6a4
  1. 4
      src/domain/UBGraphicsScene.cpp
  2. 9
      src/domain/UBGraphicsVectorItem.cpp
  3. 8
      src/domain/UBGraphicsVectorItem.h

@ -1043,10 +1043,10 @@ void UBGraphicsScene::addVectorItemToCurrentStroke(UBGraphicsVectorItem* vectorI
vectorItem->SetDelegate();
mpLastVector = vectorItem;
mAddedItems.insert(vectorItem);
mAddedItems.insert(vectorItem->StrokeGroup());
// Here we add the item to the scene
addItem(vectorItem);
addItem(vectorItem->StrokeGroup());
}

@ -59,6 +59,15 @@ void UBGraphicsVectorItem::initialize()
setFlag(QGraphicsItem::ItemIsSelectable, true);
setFlag(QGraphicsItem::ItemIsMovable, true);
setSublines();
mStrokeGroup = new UBGraphicsStrokesGroup();
mStrokeGroup->setTransform(this->transform());
UBGraphicsItem::assignZValue(mStrokeGroup, this->zValue());
if(this->transform().isIdentity())
this->setTransform(mStrokeGroup->transform());
mStrokeGroup->addToGroup(this);
}
void UBGraphicsVectorItem::setSublines()

@ -3,6 +3,7 @@
#include <QtGui>
#include "core/UB.h"
#include "domain/UBGraphicsStrokesGroup.h"
#include "UBItem.h"
class UBItem;
@ -89,6 +90,11 @@ public:
return sublines;
}
UBGraphicsStrokesGroup* StrokeGroup()
{
return mStrokeGroup;
}
protected:
void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
@ -106,6 +112,8 @@ public:
QColor mColorOnLightBackground;
QList<QGraphicsLineItem *> sublines;
UBVectorStyle::Enum style;
UBGraphicsStrokesGroup* mStrokeGroup;
};
#endif // UBGRAPHICSVECTORITEM_H

Loading…
Cancel
Save