Krita Source Code Documentation
Loading...
Searching...
No Matches
ShapeLayerContainerModel Class Reference
+ Inheritance diagram for ShapeLayerContainerModel:

Public Member Functions

void add (KoShape *child) override
 
void remove (KoShape *child) override
 
void setResolution (qreal xRes, qreal yRes)
 
 ShapeLayerContainerModel (KisShapeLayer *parent)
 
- Public Member Functions inherited from SimpleShapeContainerModel
void add (KoShape *child) override
 
KoShapeManagerassociatedRootShapeManager () const
 
void containerChanged (KoShapeContainer *, KoShape::ChangeType) override
 
int count () const override
 
bool inheritsTransform (const KoShape *shape) const override
 
bool isClipped (const KoShape *shape) const override
 
void proposeMove (KoShape *shape, QPointF &move) override
 
void remove (KoShape *shape) override
 
void setAssociatedRootShapeManager (KoShapeManager *manager)
 
void setClipped (const KoShape *shape, bool value) override
 
void setInheritsTransform (const KoShape *shape, bool value) override
 
void shapeHasBeenAddedToHierarchy (KoShape *shape, KoShapeContainer *addedToSubtree) override
 
QList< KoShape * > shapes () const override
 
void shapeToBeRemovedFromHierarchy (KoShape *shape, KoShapeContainer *removedFromSubtree) override
 
 SimpleShapeContainerModel ()
 
 SimpleShapeContainerModel (const SimpleShapeContainerModel &rhs)
 
 ~SimpleShapeContainerModel () override
 
- Public Member Functions inherited from KoShapeContainerModel
virtual void childChanged (KoShape *shape, KoShape::ChangeType type)
 
void deleteOwnedShapes ()
 
 KoShapeContainerModel ()
 default constructor
 
virtual ~KoShapeContainerModel ()
 destructor
 

Private Attributes

qreal m_xRes {72.0}
 
qreal m_yRes {72.0}
 
KisShapeLayerq
 

Additional Inherited Members

- Protected Member Functions inherited from KoShapeContainerModel
 KoShapeContainerModel (const KoShapeContainerModel &rhs)
 

Detailed Description

Definition at line 74 of file kis_shape_layer.cc.

Constructor & Destructor Documentation

◆ ShapeLayerContainerModel()

ShapeLayerContainerModel::ShapeLayerContainerModel ( KisShapeLayer * parent)
inline

Definition at line 77 of file kis_shape_layer.cc.

78 : q(parent)
79 {
80 }

Member Function Documentation

◆ add()

void ShapeLayerContainerModel::add ( KoShape * shape)
inlineoverridevirtual

Add a shape to this models store.

Parameters
shapethe shape to be managed in the container.

The shape is always added with the absolute transformation set appropriately. Here we should just squeeze it into the layer's transformation.

Implements KoShapeContainerModel.

Definition at line 82 of file kis_shape_layer.cc.

82 {
84
90 if (inheritsTransform(child)) {
91 QTransform parentTransform = q->absoluteTransformation();
92 child->applyAbsoluteTransformation(parentTransform.inverted());
93 }
94 child->setResolution(m_xRes, m_yRes);
95 }
QTransform absoluteTransformation() const
Definition KoShape.cpp:382
void add(KoShape *child) override
bool inheritsTransform(const KoShape *shape) const override
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130

References KoShape::absoluteTransformation(), SimpleShapeContainerModel::add(), KoShape::applyAbsoluteTransformation(), SimpleShapeContainerModel::inheritsTransform(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_xRes, m_yRes, q, and KoShape::setResolution().

◆ remove()

void ShapeLayerContainerModel::remove ( KoShape * shape)
inlineoverridevirtual

Remove a shape to be completely separated from the model.

Parameters
shapethe shape to be removed.

Implements KoShapeContainerModel.

Definition at line 97 of file kis_shape_layer.cc.

97 {
99 if (inheritsTransform(child)) {
100 QTransform parentTransform = q->absoluteTransformation();
101 child->applyAbsoluteTransformation(parentTransform);
102 }
103
105 }
void remove(KoShape *shape) override

References KoShape::absoluteTransformation(), KoShape::applyAbsoluteTransformation(), SimpleShapeContainerModel::inheritsTransform(), KIS_SAFE_ASSERT_RECOVER_NOOP, q, and SimpleShapeContainerModel::remove().

◆ setResolution()

void ShapeLayerContainerModel::setResolution ( qreal xRes,
qreal yRes )
inline

Definition at line 107 of file kis_shape_layer.cc.

107 {
108 if (!qFuzzyCompare(m_xRes, xRes) || !qFuzzyCompare(m_yRes, yRes)) {
109 m_xRes = xRes;
110 m_yRes = yRes;
111 Q_FOREACH (KoShape *shape, shapes()) {
112 shape->setResolution(xRes, yRes);
113 }
114 }
115 }
virtual void setResolution(qreal xRes, qreal yRes)
Definition KoShape.cpp:1416
QList< KoShape * > shapes() const override
static bool qFuzzyCompare(half p1, half p2)

References m_xRes, m_yRes, qFuzzyCompare(), KoShape::setResolution(), and SimpleShapeContainerModel::shapes().

Member Data Documentation

◆ m_xRes

qreal ShapeLayerContainerModel::m_xRes {72.0}
private

Definition at line 119 of file kis_shape_layer.cc.

119{72.0};

◆ m_yRes

qreal ShapeLayerContainerModel::m_yRes {72.0}
private

Definition at line 120 of file kis_shape_layer.cc.

120{72.0};

◆ q

KisShapeLayer* ShapeLayerContainerModel::q
private

Definition at line 118 of file kis_shape_layer.cc.


The documentation for this class was generated from the following file: