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

#include <KoTextShapeDataBase.h>

+ Inheritance diagram for KoTextShapeDataBase:

Public Types

enum  ResizeMethod {
  AutoResize , AutoGrowWidth , AutoGrowHeight , AutoGrowWidthAndHeight ,
  ShrinkToFitResize , NoResize
}
 

Public Member Functions

QTextDocument * document () const
 return the document
 
 KoTextShapeDataBase ()
 constructor
 
ResizeMethod resizeMethod () const
 
void setResizeMethod (ResizeMethod method)
 
void setShapeMargins (const KoInsets &margins)
 
void setVerticalAlignment (Qt::Alignment alignment)
 
KoInsets shapeMargins () const
 
Qt::Alignment verticalAlignment () const
 
 ~KoTextShapeDataBase () override
 
- Public Member Functions inherited from KoShapeUserData
virtual KoShapeUserDataclone () const =0
 
 KoShapeUserData (QObject *parent=0)
 Constructor.
 
 ~KoShapeUserData () override
 

Protected Member Functions

 KoTextShapeDataBase (KoTextShapeDataBasePrivate *)
 constructor
 
- Protected Member Functions inherited from KoShapeUserData
 KoShapeUserData (const KoShapeUserData &rhs)
 

Protected Attributes

KoTextShapeDataBasePrivated_ptr
 

Detailed Description

Definition at line 25 of file KoTextShapeDataBase.h.

Member Enumeration Documentation

◆ ResizeMethod

Enum to describe the text document's automatic resizing behaviour.

Enumerator
AutoResize 

Resize the shape to fit the content. This makes sure that the text shape takes op only as much space as absolutely necessary to fit the entire text into its boundaries.

AutoGrowWidth 

Specifies whether or not to automatically increase the width of the drawing object if text is added to fit the entire width of the text into its boundaries. Compared to AutoResize above this only applied to the width whereas the height is not resized. Also this only grows but does not shrink again if text is removed again.

AutoGrowHeight 

Specifies whether or not to automatically increase the height of the drawing object if text is added to fit the entire height of the text into its boundaries.

AutoGrowWidthAndHeight 

This combines the AutoGrowWidth and AutoGrowHeight and automatically increase width and height to fit the entire text into its boundaries.

ShrinkToFitResize 

Shrink the content displayed within the shape to match into the shape's boundaries. This will scale the content down as needed to display the whole document.

NoResize 

Deactivates auto-resizing. This is the default resizing method.

Definition at line 57 of file KoTextShapeDataBase.h.

Constructor & Destructor Documentation

◆ KoTextShapeDataBase() [1/2]

KoTextShapeDataBase::KoTextShapeDataBase ( )

constructor

◆ ~KoTextShapeDataBase()

KoTextShapeDataBase::~KoTextShapeDataBase ( )
override

Definition at line 35 of file KoTextShapeDataBase.cpp.

36{
37 delete d_ptr;
38}
KoTextShapeDataBasePrivate * d_ptr

References d_ptr.

◆ KoTextShapeDataBase() [2/2]

KoTextShapeDataBase::KoTextShapeDataBase ( KoTextShapeDataBasePrivate * dd)
protected

constructor

Definition at line 30 of file KoTextShapeDataBase.cpp.

31 : d_ptr(dd)
32{
33}

Member Function Documentation

◆ document()

QTextDocument * KoTextShapeDataBase::document ( ) const

return the document

Definition at line 40 of file KoTextShapeDataBase.cpp.

41{
42 Q_D(const KoTextShapeDataBase);
43 return d->document.data();
44}

◆ resizeMethod()

KoTextShapeDataBase::ResizeMethod KoTextShapeDataBase::resizeMethod ( ) const

Returns the auto-resizing mode. By default, this is NoResize.

See also
setResizeMethod

Definition at line 79 of file KoTextShapeDataBase.cpp.

80{
81 Q_D(const KoTextShapeDataBase);
82 return d->resizeMethod;
83}

◆ setResizeMethod()

void KoTextShapeDataBase::setResizeMethod ( KoTextShapeDataBase::ResizeMethod method)

Specifies how the document should be resized upon a change in the document.

If auto-resizing is turned on, text will not be wrapped unless enforced by e.g. a newline.

By default, NoResize is set.

Definition at line 71 of file KoTextShapeDataBase.cpp.

72{
74 if (d->resizeMethod == method)
75 return;
76 d->resizeMethod = method;
77}

◆ setShapeMargins()

void KoTextShapeDataBase::setShapeMargins ( const KoInsets & margins)

Set the margins that will make the shapes text area smaller. The shape that owns this textShapeData object will layout text in an area confined by the shape size made smaller by the margins set here.

Parameters
marginsthe margins that shrink the text area.

Definition at line 46 of file KoTextShapeDataBase.cpp.

47{
49 d->margins = margins;
50}

◆ setVerticalAlignment()

void KoTextShapeDataBase::setVerticalAlignment ( Qt::Alignment alignment)

Sets the vertical alignment of all the text inside the shape.

Definition at line 58 of file KoTextShapeDataBase.cpp.

59{
61 d->textAlignment = (d->textAlignment & Qt::AlignHorizontal_Mask)
62 | (alignment & Qt::AlignVertical_Mask);
63}

◆ shapeMargins()

KoInsets KoTextShapeDataBase::shapeMargins ( ) const

returns the currently set margins for the shape.

Definition at line 52 of file KoTextShapeDataBase.cpp.

53{
54 Q_D(const KoTextShapeDataBase);
55 return d->margins;
56}

◆ verticalAlignment()

Qt::Alignment KoTextShapeDataBase::verticalAlignment ( ) const

Returns the vertical alignment of all the text in the shape

Definition at line 65 of file KoTextShapeDataBase.cpp.

66{
67 Q_D(const KoTextShapeDataBase);
68 return d->textAlignment & Qt::AlignVertical_Mask;
69}

Member Data Documentation

◆ d_ptr

KoTextShapeDataBasePrivate* KoTextShapeDataBase::d_ptr
protected

Definition at line 99 of file KoTextShapeDataBase.h.


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