Krita Source Code Documentation
Loading...
Searching...
No Matches
KoSelection Class Reference

#include <KoSelection.h>

+ Inheritance diagram for KoSelection:

Classes

class  Private
 

Signals

void currentLayerChanged (const KoShapeLayer *layer)
 emitted when the current layer is changed
 
void selectionChanged ()
 emitted when the selection is changed
 

Public Member Functions

KoShapeLayeractiveLayer () const
 
QRectF boundingRect () const override
 Get the bounding box of the shape.
 
int count () const
 return the selection count, i.e. the number of all selected shapes
 
void deselect (KoShape *shape)
 
void deselectAll ()
 clear the selections list
 
KoShapefirstSelectedShape () const
 
bool hitTest (const QPointF &position) const override
 Check if the shape is hit on position.
 
bool isSelected (const KoShape *shape) const
 return true if the shape is selected
 
 KoSelection (QObject *parent=0)
 
void notifyShapeChanged (ChangeType type, KoShape *shape) override
 
QRectF outlineRect () const override
 
void paint (QPainter &painter) const override
 Paint the shape fill The class extending this one is responsible for painting itself. painter is expected to be preconfigured to work in "document" pixels.
 
void select (KoShape *shape)
 
const QList< KoShape * > selectedEditableShapes () const
 
const QList< KoShape * > selectedEditableShapesAndDelegates () const
 
const QList< KoShape * > selectedShapes () const
 
const QList< KoShape * > selectedVisibleShapes () const
 
void setActiveLayer (KoShapeLayer *layer)
 
void setSize (const QSizeF &size) override
 Resize the shape.
 
QSizeF size () const override
 Get the size of the shape in pt.
 
 ~KoSelection () override
 
- 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)
 
KoShapeAnchoranchor () const
 
void applyAbsoluteTransformation (const QTransform &matrix)
 
void applyTransformation (const QTransform &matrix)
 
virtual QSharedPointer< KoShapeBackgroundbackground () const
 
virtual ChildZOrderPolicy childZOrderPolicy ()
 
KoClipMaskclipMask () const
 Returns the currently set clip mask or 0 if there is no clip mask set.
 
KoClipPathclipPath () const
 Returns the currently set clip path or 0 if there is no clip path set.
 
virtual KoShapecloneShape () const
 creates a deep copy of the shape or shape's subtree
 
KoShapecloneShapeAndBakeAbsoluteTransform () 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.
 
KoFilterEffectStackfilterEffectStack () 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
 
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 void paintMarkers (QPainter &painter) const
 paintStroke paints the shape's markers
 
virtual QVector< PaintOrderpaintOrder () const
 paintOrder
 
virtual void paintStroke (QPainter &painter) const
 paintStroke paints the shape's stroked outline
 
KoShapeContainerparent () 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 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)
 
KoShapeShadowshadow () 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 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 update () const
 
virtual void updateAbsolute (const QRectF &rect) const
 
KoShapeUserDatauserData () const
 
virtual void waitUntilReady (bool asynchronous=true) const
 
qint16 zIndex () const
 
virtual ~KoShape ()
 Destructor.
 
- Public Member Functions inherited from KoShape::ShapeChangeListener
virtual ~ShapeChangeListener ()
 

Protected Member Functions

 KoSelection (const KoSelection &rhs)
 
- Protected Member Functions inherited from KoShape
 KoShape (const KoShape &rhs)
 
QList< ShapeChangeListener * > listeners () const
 
void setSizeImpl (const QSizeF &size) const
 
virtual void shapeChanged (ChangeType type, KoShape *shape=0)
 
void shapeChangedPriv (KoShape::ChangeType type)
 
QTransform transform () const
 return the current matrix that contains the rotation/scale/position of this shape
 

Private Attributes

QSharedDataPointer< Privated
 

Additional Inherited Members

- Public Types inherited from KoShape
enum  ChangeType {
  PositionChanged , RotationChanged , ScaleChanged , ShearChanged ,
  SizeChanged , GenericMatrixChange , KeepAspectRatioChange , ParentChanged ,
  Deleted , StrokeChanged , BackgroundChanged , ShadowChanged ,
  BorderChanged , ParameterChanged , ContentChanged , TextRunAroundChanged ,
  ChildChanged , ConnectionPointChanged , ClipPathChanged , ClipMaskChanged ,
  TransparencyChanged
}
 Used by shapeChanged() to select which change was made. More...
 
enum  ChildZOrderPolicy { ChildZDefault , ChildZParentChild = ChildZDefault , ChildZPassThrough }
 Used by compareShapeZIndex() to order shapes. More...
 
enum  PaintOrder { Fill , Stroke , Markers }
 
enum  RunThroughLevel { Background , Foreground }
 
enum  TextRunAroundContour { ContourBox , ContourFull , ContourOutside }
 The behavior text should do when intersecting this shape. More...
 
enum  TextRunAroundSide {
  BiggestRunAroundSide , LeftRunAroundSide , RightRunAroundSide , EnoughRunAroundSide ,
  BothRunAroundSide , NoRunAround , RunThrough
}
 The behavior text should do when intersecting this shape. More...
 
- Static Public Member Functions inherited from KoShape
static QRectF absoluteOutlineRect (const QList< KoShape * > &shapes)
 
static QRectF boundingRect (const QList< KoShape * > &shapes)
 
static bool compareShapeZIndex (KoShape *s1, KoShape *s2)
 
static KisHandlePainterHelper createHandlePainterHelperDocument (QPainter *painter, KoShape *shape, qreal handleRadius, int decorationThickness)
 
static KisHandlePainterHelper createHandlePainterHelperView (QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius=0.0, int decorationThickness=1)
 
static QVector< PaintOrderdefaultPaintOrder ()
 default paint order as per SVG specification
 
static QList< KoShape * > linearizeSubtree (const QList< KoShape * > &shapes)
 
static QList< KoShape * > linearizeSubtreeSorted (const QList< KoShape * > &shapes)
 
- Static Public Attributes inherited from KoShape
static const qint16 maxZIndex = std::numeric_limits<qint16>::max()
 
static const qint16 minZIndex = std::numeric_limits<qint16>::min()
 

Detailed Description

A selection is a shape that contains a number of references to shapes. That means that a selection can be manipulated in the same way as a single shape.

Note that a single shape can be selected in one view, and not in another, and that in a single view, more than one selection can be present. So selections should not be seen as singletons, or as something completely transient.

A selection, however, should not be selectable. We need to think a little about the interaction here.

Definition at line 37 of file KoSelection.h.

Constructor & Destructor Documentation

◆ KoSelection() [1/2]

KoSelection::KoSelection ( QObject * parent = 0)

Definition at line 22 of file KoSelection.cpp.

23 : QObject(parent)
24 , KoShape()
25 , d(new Private)
26{
27 connect(d->selectionChangedCompressor, SIGNAL(timeout()), SIGNAL(selectionChanged()));
28}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void selectionChanged()
emitted when the selection is changed
QSharedDataPointer< Private > d
KoShapeContainer * parent() const
Definition KoShape.cpp:1039

References connect(), d, and selectionChanged().

◆ ~KoSelection()

KoSelection::~KoSelection ( )
override

Definition at line 37 of file KoSelection.cpp.

38{
39}

◆ KoSelection() [2/2]

KoSelection::KoSelection ( const KoSelection & rhs)
protected

Definition at line 30 of file KoSelection.cpp.

31 : QObject()
32 , KoShape(rhs)
33 , d(rhs.d)
34{
35}

Member Function Documentation

◆ activeLayer()

KoShapeLayer * KoSelection::activeLayer ( ) const

Returns a currently active layer.

Returns
the currently active layer, or zero if there is none

Definition at line 225 of file KoSelection.cpp.

226{
227 return d->activeLayer;
228}

References d.

◆ boundingRect()

QRectF KoSelection::boundingRect ( ) const
overridevirtual

Get the bounding box of the shape.

This includes the line width and the shadow of the shape

Returns
the bounding box of the shape

Reimplemented from KoShape.

Definition at line 74 of file KoSelection.cpp.

75{
77}
const QList< KoShape * > selectedVisibleShapes() const
virtual QRectF boundingRect() const
Get the bounding box of the shape.
Definition KoShape.cpp:335

References KoShape::boundingRect(), and selectedVisibleShapes().

◆ count()

int KoSelection::count ( ) const

return the selection count, i.e. the number of all selected shapes

Definition at line 142 of file KoSelection.cpp.

143{
144 return d->selectedShapes.size();
145}

References d.

◆ currentLayerChanged

void KoSelection::currentLayerChanged ( const KoShapeLayer * layer)
signal

emitted when the current layer is changed

◆ deselect()

void KoSelection::deselect ( KoShape * shape)

Removes a selected shape.

If the shape is a KoShapeGroup all of its child shapes are automatically removed from the selection. If the shape has no parent or is not a KoShapeGroup, only the given shape is removed from the selection. If the given shape is a child of a KoShapeGroup and recursive selection is enabled the all parents and their child shape up to the toplevel KoShapeGroup are removed from the selection.

Parameters
shapethe shape to remove from the selection

Definition at line 110 of file KoSelection.cpp.

111{
112 if (!d->selectedShapes.contains(shape))
113 return;
114
115 d->selectedShapes.removeAll(shape);
116 shape->removeShapeChangeListener(this);
117
118 if (d->selectedShapes.size() == 1) {
119 setTransformation(d->selectedShapes.first()->absoluteTransformation());
120 }
121
122 d->selectionChangedCompressor->start();
123}
void removeShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1368
void setTransformation(const QTransform &matrix)
Definition KoShape.cpp:417

References d, KoShape::removeShapeChangeListener(), and KoShape::setTransformation().

◆ deselectAll()

void KoSelection::deselectAll ( )

clear the selections list

Definition at line 125 of file KoSelection.cpp.

126{
127
128 if (d->selectedShapes.isEmpty())
129 return;
130
131 Q_FOREACH (KoShape *shape, d->selectedShapes) {
132 shape->removeShapeChangeListener(this);
133 }
134
135 // reset the transformation matrix of the selection
136 setTransformation(QTransform());
137
138 d->selectedShapes.clear();
139 d->selectionChangedCompressor->start();
140}

References d, KoShape::removeShapeChangeListener(), and KoShape::setTransformation().

◆ firstSelectedShape()

KoShape * KoSelection::firstSelectedShape ( ) const

Return the first selected shape, or 0 if there is nothing selected.

Definition at line 214 of file KoSelection.cpp.

215{
216 return !d->selectedShapes.isEmpty() ? d->selectedShapes.first() : 0;
217}

References d.

◆ hitTest()

bool KoSelection::hitTest ( const QPointF & position) const
overridevirtual

Check if the shape is hit on position.

Parameters
positionthe position where the user clicked.
Returns
true when it hits.

Reimplemented from KoShape.

Definition at line 147 of file KoSelection.cpp.

148{
149
150 Q_FOREACH (KoShape *shape, d->selectedShapes) {
151 if (shape->isVisible()) continue;
152 if (shape->hitTest(position)) return true;
153 }
154
155 return false;
156}
virtual bool hitTest(const QPointF &position) const
Check if the shape is hit on position.
Definition KoShape.cpp:308
bool isVisible(bool recursive=true) const
Definition KoShape.cpp:979
QPointF position() const
Get the position of the shape in pt.
Definition KoShape.cpp:825

References d, KoShape::hitTest(), KoShape::isVisible(), and KoShape::position().

◆ isSelected()

bool KoSelection::isSelected ( const KoShape * shape) const

return true if the shape is selected

Definition at line 201 of file KoSelection.cpp.

202{
203 if (shape == this)
204 return true;
205
206 const KoShape *tmpShape = shape;
207 while (tmpShape && std::find(d->selectedShapes.begin(), d->selectedShapes.end(), tmpShape) == d->selectedShapes.end()) {
208 tmpShape = tmpShape->parent();
209 }
210
211 return tmpShape;
212}

References d, and KoShape::parent().

◆ notifyShapeChanged()

void KoSelection::notifyShapeChanged ( KoShape::ChangeType type,
KoShape * shape )
overridevirtual

Implements KoShape::ShapeChangeListener.

Definition at line 230 of file KoSelection.cpp.

231{
232 Q_UNUSED(shape);
233 if (type == KoShape::Deleted) {
234 deselect(shape);
235
236 // HACK ALERT: the caller will also remove the listener, which was
237 // removed in deselect(), so re-add it here
238 shape->addShapeChangeListener(this);
239 }
240}
void deselect(KoShape *shape)
void addShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1360
@ Deleted
the shape was deleted
Definition KoShape.h:104

References KoShape::addShapeChangeListener(), KoShape::Deleted, and deselect().

◆ outlineRect()

QRectF KoSelection::outlineRect ( ) const
overridevirtual

returns the outline of the shape in the form of a rect. The outlineRect returned will always be relative to the position() of the shape, so moving the shape will not alter the result. The outline is used to calculate the boundingRect.

Returns
the outline of the shape in the form of a rect.

Reimplemented from KoShape.

Definition at line 57 of file KoSelection.cpp.

58{
59 const QTransform invertedTransform = transformation().inverted();
60 QRectF boundingRect;
61
62 Q_FOREACH (KoShape *shape, selectedVisibleShapes()) {
63 // it is cheaper to invert-transform each outline, than
64 // to group 300+ rotated rectangles into a polygon
66 invertedTransform.map(
67 shape->absoluteTransformation().map(
68 QPolygonF(shape->outlineRect()))).boundingRect();
69 }
70
71 return boundingRect;
72}
QRectF boundingRect() const override
Get the bounding box of the shape.
virtual QRectF outlineRect() const
Definition KoShape.cpp:637
QTransform absoluteTransformation() const
Definition KoShape.cpp:382
QTransform transformation() const
Returns the shapes local transformation matrix.
Definition KoShape.cpp:424

References KoShape::absoluteTransformation(), boundingRect(), KoShape::outlineRect(), selectedVisibleShapes(), and KoShape::transformation().

◆ paint()

void KoSelection::paint ( QPainter & painter) const
overridevirtual

Paint the shape fill The class extending this one is responsible for painting itself. painter is expected to be preconfigured to work in "document" pixels.

Parameters
painterused for painting the shape

Implements KoShape.

Definition at line 41 of file KoSelection.cpp.

42{
43 Q_UNUSED(painter);
44}

◆ select()

void KoSelection::select ( KoShape * shape)

Adds a shape to the selection.

If the shape is a KoShapeGroup all of its child shapes are automatically added to the selection. If the shape has no parent or is not a KoShapeGroup, only the given shape is added to the selection. If the given shape is a child of a KoShapeGroup and recursive selection is enabled the all parents and their child shapes up to the toplevel KoShapeGroup are added to the selection.

Parameters
shapethe shape to add to the selection

Definition at line 79 of file KoSelection.cpp.

80{
81 KIS_SAFE_ASSERT_RECOVER_RETURN(shape != this);
83
84 if (!shape->isSelectable() || !shape->isVisible()) {
85 return;
86 }
87
88 // check recursively
89 if (isSelected(shape)) {
90 return;
91 }
92
93 // find the topmost parent to select
94 while (KoShapeGroup *parentGroup = dynamic_cast<KoShapeGroup*>(shape->parent())) {
95 shape = parentGroup;
96 }
97
98 d->selectedShapes << shape;
99 shape->addShapeChangeListener(this);
100
101 if (d->selectedShapes.size() == 1) {
103 } else {
104 setTransformation(QTransform());
105 }
106
107 d->selectionChangedCompressor->start();
108}
bool isSelected(const KoShape *shape) const
return true if the shape is selected
bool isSelectable() const
Definition KoShape.cpp:1014
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128

References KoShape::absoluteTransformation(), KoShape::addShapeChangeListener(), d, KoShape::isSelectable(), isSelected(), KoShape::isVisible(), KIS_SAFE_ASSERT_RECOVER_RETURN, KoShape::parent(), and KoShape::setTransformation().

◆ selectedEditableShapes()

const QList< KoShape * > KoSelection::selectedEditableShapes ( ) const

Same as selectedShapes() but only for editable shapes. Used by the algorithms that modify the image

Definition at line 174 of file KoSelection.cpp.

175{
177
178 KritaUtils::filterContainer (shapes, [](KoShape *shape) {
179 return shape->isShapeEditable();
180 });
181
182 return shapes;
183}
const QList< KoShape * > selectedShapes() const
virtual bool isShapeEditable(bool recursive=true) const
checks recursively if the shape or one of its parents is not visible or locked
Definition KoShape.cpp:1165
auto filterContainer(C &container, KeepIfFunction keepIf) -> decltype(bool(keepIf(container[0])), void())

References KritaUtils::filterContainer(), KoShape::isShapeEditable(), and selectedShapes().

◆ selectedEditableShapesAndDelegates()

const QList< KoShape * > KoSelection::selectedEditableShapesAndDelegates ( ) const

Same as selectedEditableShapes() but also includes shapes delegates. Used for

Definition at line 185 of file KoSelection.cpp.

186{
187 QList<KoShape*> shapes;
188 Q_FOREACH (KoShape *shape, selectedShapes()) {
189 QSet<KoShape *> delegates = shape->toolDelegates();
190 if (delegates.isEmpty()) {
191 shapes.append(shape);
192 } else {
193 Q_FOREACH (KoShape *delegatedShape, delegates) {
194 shapes.append(delegatedShape);
195 }
196 }
197 }
198 return shapes;
199}
QSet< KoShape * > toolDelegates() const
Definition KoShape.cpp:1310

References selectedShapes(), and KoShape::toolDelegates().

◆ selectedShapes()

const QList< KoShape * > KoSelection::selectedShapes ( ) const

Return the list of selected shapes

Returns
the list of selected shapes

Definition at line 158 of file KoSelection.cpp.

159{
160 return d->selectedShapes;
161}

References d.

◆ selectedVisibleShapes()

const QList< KoShape * > KoSelection::selectedVisibleShapes ( ) const

Same as selectedShapes() but only for shapes in visible state. Used by the algorithms that draw shapes on the image

Definition at line 163 of file KoSelection.cpp.

164{
166
167 KritaUtils::filterContainer (shapes, [](KoShape *shape) {
168 return shape->isVisible();
169 });
170
171 return shapes;
172}

References KritaUtils::filterContainer(), KoShape::isVisible(), and selectedShapes().

◆ selectionChanged

void KoSelection::selectionChanged ( )
signal

emitted when the selection is changed

◆ setActiveLayer()

void KoSelection::setActiveLayer ( KoShapeLayer * layer)

Sets the currently active layer.

Parameters
layerthe new active layer

Definition at line 219 of file KoSelection.cpp.

220{
221 d->activeLayer = layer;
222 Q_EMIT currentLayerChanged(layer);
223}
void currentLayerChanged(const KoShapeLayer *layer)
emitted when the current layer is changed

References currentLayerChanged(), and d.

◆ setSize()

void KoSelection::setSize ( const QSizeF & size)
overridevirtual

Resize the shape.

Parameters
sizethe new size of the shape. This is different from scaling as scaling is a so called secondary operation which is comparable to zooming in instead of changing the size of the basic shape. Easiest example of this difference is that using this method will not distort the size of pattern-fills and strokes.

Reimplemented from KoShape.

Definition at line 46 of file KoSelection.cpp.

47{
48 Q_UNUSED(size);
49 qWarning() << "WARNING: KoSelection::setSize() should never be used!";
50}
QSizeF size() const override
Get the size of the shape in pt.

References size().

◆ size()

QSizeF KoSelection::size ( ) const
overridevirtual

Get the size of the shape in pt.

The size is in shape coordinates.

Returns
the size of the shape as set by setSize()

Reimplemented from KoShape.

Definition at line 52 of file KoSelection.cpp.

53{
54 return outlineRect().size();
55}
QRectF outlineRect() const override

References outlineRect().

Member Data Documentation

◆ d

QSharedDataPointer<Private> KoSelection::d
private

Definition at line 149 of file KoSelection.h.


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