LibrePCB Developers Documentation
PrimitiveTextGraphicsItem Class Referencefinal

The PrimitiveTextGraphicsItem class is the graphical representation of a text. More...

#include <primitivetextgraphicsitem.h>

Inherits QGraphicsItem.

+ Collaboration diagram for PrimitiveTextGraphicsItem:

Public Types

enum  Font
 

Public Member Functions

 PrimitiveTextGraphicsItem (const PrimitiveTextGraphicsItem &other)=delete
 
 PrimitiveTextGraphicsItem (QGraphicsItem *parent=nullptr) noexcept
 
 ~PrimitiveTextGraphicsItem () noexcept
 
void setPosition (const Point &pos) noexcept
 
void setRotation (const Angle &rot) noexcept
 
void setText (const QString &text, bool parseOverlines=false) noexcept
 
void setHeight (const PositiveLength &height) noexcept
 
void setAlignment (const Alignment &align) noexcept
 
void setFont (Font font) noexcept
 
void setLayer (const std::shared_ptr< GraphicsLayer > &layer) noexcept
 
void setShapeEnabled (bool enabled) noexcept
 
QRectF boundingRect () const noexcept override
 
QPainterPath shape () const noexcept override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexcept override
 
PrimitiveTextGraphicsItemoperator= (const PrimitiveTextGraphicsItem &rhs)=delete
 

Private Member Functions

void layerEdited (const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
 
void updateBoundingRectAndShape () noexcept
 

Private Attributes

std::shared_ptr< GraphicsLayermLayer
 
QString mText
 
QString mDisplayText
 
bool mParseOverlines
 
QVector< QLineF > mOverlines
 
PositiveLength mHeight
 
Alignment mAlignment
 
bool mRotate180
 
QFont mFont
 
QPen mPen
 
QPen mPenHighlighted
 
int mTextFlags
 
QRectF mBoundingRect
 
QPainterPath mShape
 
bool mShapeEnabled
 
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
 

Detailed Description

The PrimitiveTextGraphicsItem class is the graphical representation of a text.

Member Enumeration Documentation

◆ Font

enum Font
strong
Enumerator
SansSerif 
Monospace 

Constructor & Destructor Documentation

◆ PrimitiveTextGraphicsItem() [1/2]

◆ PrimitiveTextGraphicsItem() [2/2]

PrimitiveTextGraphicsItem ( QGraphicsItem *  parent = nullptr)
explicitnoexcept

◆ ~PrimitiveTextGraphicsItem()

Member Function Documentation

◆ setPosition()

void setPosition ( const Point pos)
noexcept

◆ setRotation()

void setRotation ( const Angle rot)
noexcept
+ Here is the call graph for this function:

◆ setText()

void setText ( const QString &  text,
bool  parseOverlines = false 
)
noexcept
+ Here is the call graph for this function:

◆ setHeight()

void setHeight ( const PositiveLength height)
noexcept
+ Here is the call graph for this function:

◆ setAlignment()

void setAlignment ( const Alignment align)
noexcept
+ Here is the call graph for this function:

◆ setFont()

void setFont ( Font  font)
noexcept
+ Here is the call graph for this function:

◆ setLayer()

void setLayer ( const std::shared_ptr< GraphicsLayer > &  layer)
noexcept

◆ setShapeEnabled()

void setShapeEnabled ( bool  enabled)
inlinenoexcept

◆ boundingRect()

QRectF boundingRect ( ) const
inlineoverridenoexcept
+ Here is the call graph for this function:

◆ shape()

QPainterPath shape ( ) const
overridenoexcept
+ Here is the caller graph for this function:

◆ paint()

void paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
overridenoexcept
+ Here is the caller graph for this function:

◆ operator=()

PrimitiveTextGraphicsItem& operator= ( const PrimitiveTextGraphicsItem rhs)
delete
+ Here is the caller graph for this function:

◆ layerEdited()

void layerEdited ( const GraphicsLayer layer,
GraphicsLayer::Event  event 
)
privatenoexcept
+ Here is the caller graph for this function:

◆ updateBoundingRectAndShape()

void updateBoundingRectAndShape ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mLayer

std::shared_ptr<GraphicsLayer> mLayer
private

◆ mText

QString mText
private

◆ mDisplayText

QString mDisplayText
private

◆ mParseOverlines

bool mParseOverlines
private

◆ mOverlines

QVector<QLineF> mOverlines
private

◆ mHeight

PositiveLength mHeight
private

◆ mAlignment

Alignment mAlignment
private

◆ mRotate180

bool mRotate180
private

◆ mFont

QFont mFont
private

◆ mPen

QPen mPen
private

◆ mPenHighlighted

QPen mPenHighlighted
private

◆ mTextFlags

int mTextFlags
private

◆ mBoundingRect

QRectF mBoundingRect
private

◆ mShape

QPainterPath mShape
private

◆ mShapeEnabled

bool mShapeEnabled
private

◆ mOnLayerEditedSlot

GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
private

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