|
Krita Source Code Documentation
|
#include <KoShapeContainer.h>
Inheritance diagram for KoShapeContainer:Classes | |
| struct | ShapeInterface |
Public Member Functions | |
| void | addShape (KoShape *shape) |
| bool | inheritsTransform (const KoShape *shape) const |
| bool | isClipped (const KoShape *child) const |
| KoShapeContainer (KoShapeContainerModel *model=0) | |
| KoShapeContainerModel * | model () const |
| void | paint (QPainter &painter) const override |
| reimplemented | |
| virtual void | paintComponent (QPainter &painter) const =0 |
| Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does. | |
| Private (const Private &rhs, KoShapeContainer *q) | |
| Private (KoShapeContainer *q) | |
| void | removeShape (KoShape *shape) |
| void | setClipped (const KoShape *child, bool clipping) |
| void | setInheritsTransform (const KoShape *shape, bool inherit) |
| int | shapeCount () const |
| ShapeInterface * | shapeInterface () |
| QList< KoShape * > | shapes () const |
| virtual void | update () const |
| void | update () const override |
| reimplemented | |
| ~KoShapeContainer () override | |
| virtual | ~Private () |
Public Member Functions inherited from KoShape | |
| QRectF | absoluteOutlineRect () const |
| QPointF | absolutePosition (KoFlake::AnchorPosition anchor=KoFlake::Center) const |
| QTransform | absoluteTransformation () const |
| bool | addDependee (KoShape *shape) |
| QString | additionalAttribute (const QString &name) const |
| void | addShapeChangeListener (ShapeChangeListener *listener) |
| KoShapeAnchor * | anchor () const |
| void | applyAbsoluteTransformation (const QTransform &matrix) |
| void | applyTransformation (const QTransform &matrix) |
| virtual QSharedPointer< KoShapeBackground > | background () const |
| virtual QRectF | boundingRect () const |
| Get the bounding box of the shape. | |
| virtual ChildZOrderPolicy | childZOrderPolicy () |
| KoClipMask * | clipMask () const |
| Returns the currently set clip mask or 0 if there is no clip mask set. | |
| KoClipPath * | clipPath () const |
| Returns the currently set clip path or 0 if there is no clip path set. | |
| virtual KoShape * | cloneShape () const |
| creates a deep copy of the shape or shape's subtree | |
| KoShape * | cloneShapeAndBakeAbsoluteTransform () const |
creates a deep copy of the shape/shapes tree and bakes the absolute transform of this into the resulting shape. | |
| void | copySettings (const KoShape *shape) |
| QList< KoShape * > | dependees () const |
| Returns list of shapes depending on this shape. | |
| QPointF | documentToShape (const QPointF &point) const |
| Transforms point from document coordinates to shape coordinates. | |
| QRectF | documentToShape (const QRectF &rect) const |
| Transform rect from document coordinates to shape coordinates. | |
| KoFilterEffectStack * | filterEffectStack () const |
| bool | hasAdditionalAttribute (const QString &name) const |
| bool | hasCommonParent (const KoShape *shape) const |
| bool | hasDependee (KoShape *shape) const |
| Returns if the given shape is dependent on this shape. | |
| virtual bool | hasTransparency () const |
| virtual bool | hitTest (const QPointF &position) const |
| Check if the shape is hit on position. | |
| QString | hyperLink () const |
| bool | inheritBackground () const |
| inheritBackground shows if the shape inherits background from its parent | |
| bool | inheritPaintOrder () const |
| inheritPaintOrder | |
| bool | inheritsTransformFromAny (const QList< KoShape * > ancestorsInQuestion) const |
inheritsTransformFromAny checks if the shape inherits transformation from any of the shapes listed in ancestorsInQuestion. The inheritance is checked in recursive way. | |
| bool | inheritStroke () const |
| inheritStroke shows if the shape inherits the stroke from its parent | |
| bool | isContentProtected () const |
| bool | isGeometryProtected () const |
| bool | isPrintable () const |
| bool | isSelectable () const |
| virtual bool | isShapeEditable (bool recursive=true) const |
| checks recursively if the shape or one of its parents is not visible or locked | |
| bool | isVisible (bool recursive=true) const |
| bool | keepAspectRatio () const |
| KoShape () | |
| Constructor. | |
| qreal | minimumHeight () const |
| QString | name () const |
| void | notifyChanged () |
| virtual QPainterPath | outline () const |
| virtual QRectF | outlineRect () const |
| virtual void | paintMarkers (QPainter &painter) const |
| paintStroke paints the shape's markers | |
| virtual QVector< PaintOrder > | paintOrder () const |
| paintOrder | |
| virtual void | paintStroke (QPainter &painter) const |
| paintStroke paints the shape's stroked outline | |
| KoShapeContainer * | parent () const |
| QPointF | position () const |
| Get the position of the shape in pt. | |
| void | removeAdditionalAttribute (const QString &name) |
| void | removeAdditionalStyleAttribute (const char *name) |
| void | removeDependee (KoShape *shape) |
| void | removeShapeChangeListener (ShapeChangeListener *listener) |
| void | rotate (qreal angle) |
| Rotate the shape (relative) | |
| qreal | rotation () const |
| int | runThrough () const |
| void | scale (qreal sx, qreal sy) |
| Scale the shape using the zero-point which is the top-left corner. | |
| void | setAbsolutePosition (const QPointF &newPosition, KoFlake::AnchorPosition anchor=KoFlake::Center) |
| void | setAdditionalAttribute (const QString &name, const QString &value) |
| void | setAdditionalStyleAttribute (const char *name, const QString &value) |
| void | setAnchor (KoShapeAnchor *anchor) |
| virtual void | setBackground (QSharedPointer< KoShapeBackground > background) |
| void | setClipMask (KoClipMask *clipMask) |
| Sets a new clip mask, removing the old one. The mask is owned by the shape. | |
| void | setClipPath (KoClipPath *clipPath) |
| Sets a new clip path, removing the old one. | |
| void | setContentProtected (bool protect) |
| void | setFilterEffectStack (KoFilterEffectStack *filterEffectStack) |
| Sets the new filter effect stack, removing the old one. | |
| void | setGeometryProtected (bool on) |
| void | setHyperLink (const QString &hyperLink) |
| void | setInheritBackground (bool value) |
| setInheritBackground marks a shape as inheriting the background from the parent shape. NOTE: The currently selected background is destroyed. | |
| void | setInheritPaintOrder (bool value) |
| setInheritPaintOrder set inherit paint order. | |
| void | setInheritStroke (bool value) |
| setInheritStroke marks a shape as inheriting the stroke from the parent shape. NOTE: The currently selected stroke is destroyed. | |
| void | setKeepAspectRatio (bool keepAspect) |
| void | setMinimumHeight (qreal height) |
| void | setName (const QString &name) |
| virtual void | setPaintOrder (PaintOrder first, PaintOrder second) |
| setPaintOrder set the paint order. As there's only three entries in any given paintorder, you only need to have the first and second entry to set it. | |
| void | setParent (KoShapeContainer *parent) |
| virtual void | setPosition (const QPointF &position) |
| Set the position of the shape in pt. | |
| void | setPrintable (bool on) |
| virtual void | setResolution (qreal xRes, qreal yRes) |
| virtual void | setRunThrough (short int runThrough) |
| void | setSelectable (bool selectable) |
| void | setShadow (KoShapeShadow *shadow) |
| Sets the new shadow, removing the old one. | |
| void | setShapeId (const QString &id) |
| virtual void | setSize (const QSizeF &size) |
| Resize the shape. | |
| virtual void | setStroke (KoShapeStrokeModelSP stroke) |
| void | setTextRunAroundContour (TextRunAroundContour contour) |
| void | setTextRunAroundDistanceBottom (qreal distance) |
| void | setTextRunAroundDistanceLeft (qreal distance) |
| void | setTextRunAroundDistanceRight (qreal distance) |
| void | setTextRunAroundDistanceTop (qreal distance) |
| void | setTextRunAroundSide (TextRunAroundSide side, RunThroughLevel runThrough=Background) |
| void | setTextRunAroundThreshold (qreal threshold) |
| void | setToolDelegates (const QSet< KoShape * > &delegates) |
| void | setTransformation (const QTransform &matrix) |
| void | setTransparency (qreal transparency) |
| void | setUserData (KoShapeUserData *userData) |
| void | setVisible (bool on) |
| void | setZIndex (qint16 zIndex) |
| KoShapeShadow * | shadow () const |
| Returns the currently set shadow or 0 if there is no shadow set. | |
| virtual QPainterPath | shadowOutline () const |
| QString | shapeId () const |
| QPointF | shapeToDocument (const QPointF &point) const |
| Transforms point from shape coordinates to document coordinates. | |
| QRectF | shapeToDocument (const QRectF &rect) const |
| Transforms rect from shape coordinates to document coordinates. | |
| void | shear (qreal sx, qreal sy) |
| Shear the shape The shape will be sheared using the zero-point which is the top-left corner. | |
| virtual QSizeF | size () const |
| Get the size of the shape in pt. | |
| virtual KoSnapData | snapData () const |
| Returns additional snap data the shape wants to have snapping to. | |
| virtual KoShapeStrokeModelSP | stroke () const |
| KoInsets | strokeInsets () const |
| TextRunAroundContour | textRunAroundContour () const |
| qreal | textRunAroundDistanceBottom () const |
| qreal | textRunAroundDistanceLeft () const |
| qreal | textRunAroundDistanceRight () const |
| qreal | textRunAroundDistanceTop () const |
| TextRunAroundSide | textRunAroundSide () const |
| qreal | textRunAroundThreshold () const |
| QSet< KoShape * > | toolDelegates () const |
| QTransform | transformation () const |
| Returns the shapes local transformation matrix. | |
| qreal | transparency (bool recursive=false) const |
| virtual void | updateAbsolute (const QRectF &rect) const |
| KoShapeUserData * | userData () const |
| virtual void | waitUntilReady (bool asynchronous=true) const |
| qint16 | zIndex () const |
| virtual | ~KoShape () |
| Destructor. | |
Public Attributes | |
| KoShapeContainerModel * | model |
| KoShapeContainer::ShapeInterface | shapeInterface |
Protected Member Functions | |
| KoShapeContainer (const KoShapeContainer &rhs) | |
| void | setModel (KoShapeContainerModel *model) |
| void | setModelInit (KoShapeContainerModel *model) |
| void | shapeChanged (ChangeType type, KoShape *shape=0) override |
| virtual void | shapeCountChanged () |
Protected Member Functions inherited from KoShape | |
| KoShape (const KoShape &rhs) | |
| QList< ShapeChangeListener * > | listeners () const |
| void | setSizeImpl (const QSizeF &size) const |
| void | shapeChangedPriv (KoShape::ChangeType type) |
| QTransform | transform () const |
| return the current matrix that contains the rotation/scale/position of this shape | |
Private Attributes | |
| QScopedPointer< Private > | d |
Private Attributes inherited from KoShape::Private | |
| QList< KoShape * > | dependees |
| list of shape dependent on this shape | |
| QList< KoShape::ShapeChangeListener * > | listeners |
| KoShapeContainer * | parent |
| QSet< KoShapeManager * > | shapeManagers |
| QSet< KoShape * > | toolDelegates |
This is the base class that all Flake group-shapes are based on. Extending from this class allows you to have child-shapes. Like the KoShape class, this shape is a visible class with a position and a size. It can paint itself as well if you implement the paintComponent() method.
The most important feature of this class is that you can make other KoShape classes to be children of this container.
The effect of grouping those shapes is that their position is relative to the position of the container. Move the container and all children move with it.
Each child can optionally be said to be 'clipped' by the container. This feature will give the effect that if the child has a size and position outside the container, parts outside the container will not be shown. This is especially useful for showing cutouts of content, like images, without changing the actual content.
For so called clipped children any modification made to the container is propagated to the child. This includes rotation as well as scaling and shearing.
Maintaining the list of children can be done using the supplied methods addChild() and removeChild(). However, they only forward their requests to the data model KoShapeContainerModel and if you provide a custom implementation of that model any means can be used to maintain a list of children, as long as you will take care to register them with the appropriate shape manager.
An example usage where a custom model might be useful is when you have a container for text areas which are split into columns. If you resize the container and the width of the individual columns gets too small, the model can choose to remove a child or add one when the width allows another column.
Definition at line 55 of file KoShapeContainer.h.
|
explicit |
Constructor with custom model to be used for maintaining the list of children. For all the normal cases you don't need a custom model. Only when you want to respond to moves of the container to do something special, or disable one of the features the container normally has (like clipping). Use the default constructor in those cases.
| model | the custom model to be used for maintaining the list of children. |
Definition at line 38 of file KoShapeContainer.cpp.
|
override |
Destructor for the shape container. All children will be orphaned by calling a KoShape::setParent(0)
Definition at line 51 of file KoShapeContainer.cpp.
References d.
|
protected |
|
virtual |
Reimplemented in KoParameterShape.
Add a child to this container.
This container will NOT take over ownership of the shape. The caller or those creating the shape is responsible to delete it if not needed any longer.
| shape | the child to be managed in the container. |
Definition at line 58 of file KoShapeContainer.cpp.
References KoShape::setParent().
| bool KoShapeContainer::inheritsTransform | ( | const KoShape * | shape | ) | const |
Returns if the shape inherits the container transform.
A shape that inherits the transform of the parent container will have its share / rotation / skew etc be calculated as being the product of both its own local transformation and also that of its parent container. If you set this to true and rotate the container, the shape will get that rotation as well automatically.
| shape | the shape for which the property will be returned. |
Definition at line 89 of file KoShapeContainer.cpp.
References d.
| bool KoShapeContainer::isClipped | ( | const KoShape * | child | ) | const |
Returns if the argument child has its 'clipping' property set.
A shape that is clipped by the container will have its visible portion limited to the area where it intersects with the container. If a shape is positioned or sized such that it would be painted outside of the KoShape::outline() of its parent container, setting this property to true will clip the shape painting to the container outline.
| child | the child for which the property will be returned. |
Definition at line 119 of file KoShapeContainer.cpp.
References d.
| KoShapeContainerModel * KoShapeContainer::model | ( | ) | const |
return the model for this container
|
overridevirtual |
reimplemented
Implements KoShape.
Definition at line 96 of file KoShapeContainer.cpp.
References paintComponent().
|
pure virtual |
Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does.
| painter | used for painting the shape |
Implemented in KoShapeGroup, KoShapeLayer, KoTosContainer, and KisShapeSelection.
| KoShapeContainer::Private | ( | const Private & | rhs, |
| KoShapeContainer * | q ) |
|
explicit |
Remove a child to be completely separated from the container.
The shape will only be removed from this container but not be deleted.
| shape | the child to be removed. |
Definition at line 63 of file KoShapeContainer.cpp.
References KoShape::setParent().
Set the argument child to have its 'clipping' property set.
A shape that is clipped by the container will have its visible portion limited to the area where it intersects with the container. If a shape is positioned or sized such that it would be painted outside of the KoShape::outline() of its parent container, setting this property to true will clip the shape painting to the container outline.
| child | the child for which the property will be changed. |
| clipping | the property |
Definition at line 75 of file KoShapeContainer.cpp.
References d.
Set the shape to inherit the container transform.
A shape that inherits the transform of the parent container will have its share / rotation / skew etc be calculated as being the product of both its own local transformation and also that of its parent container. If you set this to true and rotate the container, the shape will get that rotation as well automatically.
| shape | the shape for which the property will be changed. |
| inherit | the new value |
Definition at line 82 of file KoShapeContainer.cpp.
References d.
|
protected |
|
protected |
set the model, and take control of all its children
Definition at line 154 of file KoShapeContainer.cpp.
References d, model, setModel(), and KoShape::setParent().
|
overrideprotectedvirtual |
A hook that allows inheriting classes to do something after a KoShape property changed This is called whenever the shape, position rotation or scale properties were altered.
| type | an indicator which type was changed. |
| shape | the shape. |
Reimplemented from KoShape.
Reimplemented in KoShapeGroup, and KoTosContainer.
Definition at line 106 of file KoShapeContainer.cpp.
References d, KoShape::GenericMatrixChange, KoShape::notifyChanged(), KoShape::PositionChanged, KoShape::RotationChanged, KoShape::ScaleChanged, KoShape::ShearChanged, and KoShape::SizeChanged.
| int KoShapeContainer::shapeCount | ( | ) | const |
Return the current number of children registered.
Definition at line 68 of file KoShapeContainer.cpp.
References d.
|
inlineprotectedvirtual |
This hook is for inheriting classes that need to do something on adding/removing of children. This method will be called just after the child has been added/removed. The default implementation is empty.
Definition at line 239 of file KoShapeContainer.h.
| ShapeInterface * KoShapeContainer::shapeInterface | ( | ) |
Return the list of all child shapes.
Definition at line 136 of file KoShapeContainer.cpp.
References d.
|
virtual |
Request a repaint to be queued. The repaint will be of the entire Shape, including its selection handles should this shape be selected.
This method will return immediately and only request a repaint. Successive calls will be merged into an appropriate repaint action.
Reimplemented from KoShape.
Definition at line 642 of file KoShape.cpp.
|
overridevirtual |
reimplemented
Reimplemented from KoShape.
Definition at line 126 of file KoShapeContainer.cpp.
References d, and KoShape::update().
|
private |
Definition at line 245 of file KoShapeContainer.h.
| KoShapeContainerModel * KoShapeContainer::model |
Definition at line 26 of file KoShapeContainer_p.h.
| KoShapeContainer::ShapeInterface * KoShapeContainer::shapeInterface |
Definition at line 25 of file KoShapeContainer_p.h.