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

#include <KoTosContainer.h>

+ Inheritance diagram for KoTosContainer:

Classes

class  Private
 

Public Types

enum  ResizeBehavior { TextFollowsSize , FollowTextSize , IndependentSizes , TextFollowsPreferredTextRect }
 different kinds of resizing behavior to determine how to treat text overflow More...
 
- 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...
 

Public Member Functions

KoShapecreateTextShape (KoDocumentResourceManager *documentResources=0)
 
 KoTosContainer ()
 
virtual bool loadText (const QDomElement &element)
 
void paintComponent (QPainter &painter) const override
 Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does.
 
ResizeBehavior resizeBehavior () const
 
void setPlainText (const QString &text)
 
void setResizeBehavior (ResizeBehavior resizeBehavior)
 
void setRunThrough (short int runThrough) override
 
void setTextAlignment (Qt::Alignment alignment)
 
Qt::Alignment textAlignment () const
 
 ~KoTosContainer () override
 
- Public Member Functions inherited from KoShapeContainer
void addShape (KoShape *shape)
 
bool inheritsTransform (const KoShape *shape) const
 
bool isClipped (const KoShape *child) const
 
 KoShapeContainer (KoShapeContainerModel *model=0)
 
KoShapeContainerModelmodel () const
 
void paint (QPainter &painter) const override
 reimplemented
 
 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
 
ShapeInterfaceshapeInterface ()
 
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)
 
KoShapeAnchoranchor () const
 
void applyAbsoluteTransformation (const QTransform &matrix)
 
void applyTransformation (const QTransform &matrix)
 
virtual QSharedPointer< KoShapeBackgroundbackground () const
 
virtual QRectF boundingRect () const
 Get the bounding box of the shape.
 
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
 
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< 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)
 
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)
 
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 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
 
KoShapeUserDatauserData () const
 
virtual void waitUntilReady (bool asynchronous=true) const
 
qint16 zIndex () const
 
virtual ~KoShape ()
 Destructor.
 

Protected Member Functions

 KoTosContainer (const KoTosContainer &rhs)
 
QRectF preferredTextRect () const
 
void setPreferredTextRect (const QRectF &rect)
 
void shapeChanged (ChangeType type, KoShape *shape=0) override
 
KoShapetextShape () const
 
- Protected Member Functions inherited from KoShapeContainer
 KoShapeContainer (const KoShapeContainer &rhs)
 
void setModel (KoShapeContainerModel *model)
 
void setModelInit (KoShapeContainerModel *model)
 
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

QSharedDataPointer< Privated
 

Additional Inherited Members

- 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)
 
- Public Attributes inherited from KoShapeContainer
KoShapeContainerModelmodel
 
KoShapeContainer::ShapeInterface shapeInterface
 
- 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

Container that is used to wrap a shape with a text on top. Path shapes inherit from this class to make it possible to have text associated with them.

Definition at line 24 of file KoTosContainer.h.

Member Enumeration Documentation

◆ ResizeBehavior

different kinds of resizing behavior to determine how to treat text overflow

Enumerator
TextFollowsSize 

Text area is same size as content, extra text will be clipped.

FollowTextSize 

Content shape will get resized if text grows/shrinks.

IndependentSizes 

The text can get bigger than the content.

TextFollowsPreferredTextRect 

The size/position of the text area will follow the preferredTextRect property.

Definition at line 38 of file KoTosContainer.h.

38 {
43 };
@ FollowTextSize
Content shape will get resized if text grows/shrinks.
@ TextFollowsPreferredTextRect
The size/position of the text area will follow the preferredTextRect property.
@ TextFollowsSize
Text area is same size as content, extra text will be clipped.
@ IndependentSizes
The text can get bigger than the content.

Constructor & Destructor Documentation

◆ KoTosContainer() [1/2]

KoTosContainer::KoTosContainer ( )

Definition at line 43 of file KoTosContainer.cpp.

45 , d(new Private)
46{
47}
KoShapeContainer(KoShapeContainerModel *model=0)
QSharedDataPointer< Private > d

◆ ~KoTosContainer()

KoTosContainer::~KoTosContainer ( )
override

Definition at line 55 of file KoTosContainer.cpp.

56{
57 delete textShape();
58}
KoShape * textShape() const

References textShape().

◆ KoTosContainer() [2/2]

KoTosContainer::KoTosContainer ( const KoTosContainer & rhs)
protected

Definition at line 49 of file KoTosContainer.cpp.

50 : KoShapeContainer(rhs)
51 , d(rhs.d)
52{
53}

Member Function Documentation

◆ createTextShape()

KoShape * KoTosContainer::createTextShape ( KoDocumentResourceManager * documentResources = 0)

Add text the current shape with the specified document resource manager.

Parameters
documentResources
Returns
The created text shape or 0 in case it failed

Definition at line 161 of file KoTosContainer.cpp.

162{
163 if (!documentResources) {
164 warnFlake << "KoDocumentResourceManager not found";
165 return 0;
166 }
167
168 delete textShape();
169 delete model();
170
172
173 QSet<KoShape*> delegates;
174 delegates << this;
175 KoShape *textShape = 0;
176 KoShapeFactoryBase *factory = KoShapeRegistry::instance()->get("TextShapeID");
177 if (factory) { // not installed, that's too bad, but allowed
178 textShape = factory->createDefaultShape(documentResources);
179 Q_ASSERT(textShape); // would be a bug in the text shape;
180 if (d->resizeBehavior == TextFollowsPreferredTextRect) {
181 textShape->setSize(d->preferredTextRect.size());
182 } else {
184 }
185 if (d->resizeBehavior == TextFollowsPreferredTextRect) {
186 textShape->setPosition(d->preferredTextRect.topLeft());
187 } else {
188 textShape->setPosition(QPointF(0, 0));
189 }
190 textShape->setSelectable(false);
192 KoTextShapeDataBase *shapeData = qobject_cast<KoTextShapeDataBase*>(textShape->userData());
193 Q_ASSERT(shapeData); // would be a bug in kotext
194 // TODO check if that is correct depending on the resize mode
195 shapeData->setVerticalAlignment(Qt::AlignVCenter);
197 // textShape->setZIndex(zIndex() + 1); // not needed as there as the text shape is the only sub shape
198 delegates << textShape;
199 } else {
200 warnFlake << "Text shape factory not found";
201 }
202 setToolDelegates(delegates);
203 return textShape;
204}
#define warnFlake
Definition FlakeDebug.h:16
T get(const QString &id) const
void setModel(KoShapeContainerModel *model)
void addShape(KoShape *shape)
KoShapeContainerModel * model
virtual KoShape * createDefaultShape(KoDocumentResourceManager *documentResources=0) const
static KoShapeRegistry * instance()
void setToolDelegates(const QSet< KoShape * > &delegates)
Definition KoShape.cpp:1315
KoShapeUserData * userData() const
Definition KoShape.cpp:710
virtual QSizeF size() const
Get the size of the shape in pt.
Definition KoShape.cpp:820
int runThrough() const
Definition KoShape.cpp:962
void setSelectable(bool selectable)
Definition KoShape.cpp:1009
virtual void setPosition(const QPointF &position)
Set the position of the shape in pt.
Definition KoShape.cpp:295
virtual void setRunThrough(short int runThrough)
Definition KoShape.cpp:967
virtual void setSize(const QSizeF &size)
Resize the shape.
Definition KoShape.cpp:276
void setVerticalAlignment(Qt::Alignment alignment)

References KoShapeContainer::addShape(), KoShapeFactoryBase::createDefaultShape(), d, KoGenericRegistry< T >::get(), KoShapeRegistry::instance(), KoShapeContainer::model, KoShape::runThrough(), KoShapeContainer::setModel(), KoShape::setPosition(), KoShape::setRunThrough(), KoShape::setSelectable(), KoShape::setSize(), KoShape::setToolDelegates(), KoTextShapeDataBase::setVerticalAlignment(), KoShape::size(), TextFollowsPreferredTextRect, textShape(), KoShape::userData(), and warnFlake.

◆ loadText()

bool KoTosContainer::loadText ( const QDomElement & element)
virtual

Definition at line 64 of file KoTosContainer.cpp.

65{
66 Q_UNUSED(element);
67 return false;
68}

◆ paintComponent()

void KoTosContainer::paintComponent ( QPainter & painter) const
overridevirtual

Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::paint() method does.

Parameters
painterused for painting the shape
See also
applyConversion()

Implements KoShapeContainer.

Definition at line 60 of file KoTosContainer.cpp.

61{
62}

◆ preferredTextRect()

QRectF KoTosContainer::preferredTextRect ( ) const
protected

Returns the current preferred text rectangle.

Definition at line 156 of file KoTosContainer.cpp.

157{
158 return d->preferredTextRect;
159}

References d.

◆ resizeBehavior()

KoTosContainer::ResizeBehavior KoTosContainer::resizeBehavior ( ) const

Returns the current ResizeBehavior.

Definition at line 94 of file KoTosContainer.cpp.

95{
96 return d->resizeBehavior;
97}

References d.

◆ setPlainText()

void KoTosContainer::setPlainText ( const QString & text)

Set some plain text to be displayed on the shape.

Parameters
textthe full text.

Definition at line 71 of file KoTosContainer.cpp.

72{
73 KoShape *textShape = this->textShape();
74 if (textShape == 0) {
75 warnFlake << "No text shape present in KoTosContainer";
76 return;
77 }
78 KoTextShapeDataBase *shapeData = qobject_cast<KoTextShapeDataBase*>(textShape->userData());
79 Q_ASSERT(shapeData->document());
80 shapeData->document()->setPlainText(text);
81}
QTextDocument * document() const
return the document

References KoTextShapeDataBase::document(), textShape(), KoShape::userData(), and warnFlake.

◆ setPreferredTextRect()

void KoTosContainer::setPreferredTextRect ( const QRectF & rect)
protected

Set the current preferred text rectangle. This rect contains the coordinates of the embedded text shape relative to the content shape. This value is ignored if resizeBehavior is not TextFollowsPreferredTextRect.

Parameters
rectthe new preferred text rectangle

Definition at line 144 of file KoTosContainer.cpp.

145{
146 d->preferredTextRect = rect;
147 KoShape *textShape = this->textShape();
148 //debugFlake << rect << textShape << d->resizeBehavior;
149 if (d->resizeBehavior == TextFollowsPreferredTextRect && textShape) {
150 //debugFlake << rect;
151 textShape->setPosition(rect.topLeft());
152 textShape->setSize(rect.size());
153 }
154}

References d, KoShape::setPosition(), KoShape::setSize(), TextFollowsPreferredTextRect, and textShape().

◆ setResizeBehavior()

void KoTosContainer::setResizeBehavior ( ResizeBehavior resizeBehavior)

Set the behavior that is used to resize the text or content. In order to determine what to do when there is too much text to fit or suddenly less text the user can define the wanted behavior using the ResizeBehavior

Parameters
resizeBehaviorthe new ResizeBehavior

Definition at line 83 of file KoTosContainer.cpp.

84{
85 if (d->resizeBehavior == resizeBehavior) {
86 return;
87 }
88 d->resizeBehavior = resizeBehavior;
89 if (model()) {
91 }
92}
virtual void containerChanged(KoShapeContainer *container, KoShape::ChangeType type)=0
@ SizeChanged
used after a setSize()
Definition KoShape.h:100
ResizeBehavior resizeBehavior() const

References KoShapeContainerModel::containerChanged(), d, KoShapeContainer::model, resizeBehavior(), and KoShape::SizeChanged.

◆ setRunThrough()

void KoTosContainer::setRunThrough ( short int runThrough)
overridevirtual

Set the run through property of this shape. The run through property is used to determine if the shape is behind, inside or before text.

Parameters
runThroughthe new run through;

Reimplemented from KoShape.

Definition at line 229 of file KoTosContainer.cpp.

230{
232 KoShape *textShape = this->textShape();
233 if (textShape) {
235 }
236}

References KoShape::runThrough(), KoShape::setRunThrough(), and textShape().

◆ setTextAlignment()

void KoTosContainer::setTextAlignment ( Qt::Alignment alignment)

Sets the alignment of the text.

Definition at line 99 of file KoTosContainer.cpp.

100{
101 KoShape *textShape = this->textShape();
102 if (textShape == 0) {
103 warnFlake << "No text shape present in KoTosContainer";
104 return;
105 }
106
107 // vertical
108 KoTextShapeDataBase *shapeData = qobject_cast<KoTextShapeDataBase*>(textShape->userData());
109 shapeData->setVerticalAlignment(alignment);
110
111 // horizontal
112 Q_ASSERT(shapeData->document());
113 QTextBlockFormat bf;
114 bf.setAlignment(alignment & Qt::AlignHorizontal_Mask);
115
116 QTextCursor cursor(shapeData->document());
117 cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
118 cursor.mergeBlockFormat(bf);
119
120 d->alignment = alignment;
121}

References d, KoTextShapeDataBase::document(), KoTextShapeDataBase::setVerticalAlignment(), textShape(), KoShape::userData(), and warnFlake.

◆ shapeChanged()

void KoTosContainer::shapeChanged ( ChangeType type,
KoShape * shape = 0 )
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.

Parameters
typean indicator which type was changed.
shapethe shape.

Reimplemented from KoShapeContainer.

Definition at line 212 of file KoTosContainer.cpp.

213{
214 Q_UNUSED(shape);
215 if (model() == 0) {
216 return;
217 }
218
219 if (type == SizeChanged || type == ContentChanged) {
220 model()->containerChanged(this, type);
221 }
222 // TODO is this needed?
223#if 0
224 Q_FOREACH (KoShape *shape, model()->shapes())
225 shape->notifyChanged();
226#endif
227}
QList< KoShape * > shapes() const
@ ContentChanged
the content of the shape changed e.g. a new image inside a pixmap/text change inside a textshape
Definition KoShape.h:110
void notifyChanged()
Definition KoShape.cpp:698

References KoShapeContainerModel::containerChanged(), KoShape::ContentChanged, KoShapeContainer::model, KoShape::notifyChanged(), KoShapeContainer::shapes(), and KoShape::SizeChanged.

◆ textAlignment()

Qt::Alignment KoTosContainer::textAlignment ( ) const

Returns the alignment of all text

Definition at line 123 of file KoTosContainer.cpp.

124{
125 KoShape *textShape = this->textShape();
126 if (textShape == 0) {
127 warnFlake << "No text shape present in KoTosContainer";
128 return Qt::AlignTop;
129 }
130
131 // vertical
132 KoTextShapeDataBase *shapeData = qobject_cast<KoTextShapeDataBase*>(textShape->userData());
133 // the model makes sure it contains a shape that has a KoTextShapeDataBase set so no need to check that
134 Qt::Alignment answer = shapeData->verticalAlignment() & Qt::AlignVertical_Mask;
135
136 // horizontal
137 Q_ASSERT(shapeData->document());
138 QTextCursor cursor(shapeData->document());
139 answer = answer | (cursor.blockFormat().alignment() & Qt::AlignHorizontal_Mask);
140
141 return answer;
142}
Qt::Alignment verticalAlignment() const

References KoTextShapeDataBase::document(), textShape(), KoShape::userData(), KoTextShapeDataBase::verticalAlignment(), and warnFlake.

◆ textShape()

KoShape * KoTosContainer::textShape ( ) const
protected

Returns the text shape

Returns
textshape if set or 0 in case it is not yet set

Definition at line 206 of file KoTosContainer.cpp.

207{
208 const QList<KoShape*> subShapes = shapes();
209 return subShapes.isEmpty() ? 0 : subShapes.at(0);
210}

References KoShapeContainer::shapes().

Member Data Documentation

◆ d

QSharedDataPointer<Private> KoTosContainer::d
private

Definition at line 107 of file KoTosContainer.h.


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