Seamly2D
Code documentation
VTextManager Class Reference

The VTextManager class this class is used to determine whether a collection of text lines can fit into specified bounding box and with what font size. More...

#include <vtextmanager.h>

Collaboration diagram for VTextManager:

Public Member Functions

 VTextManager ()
 VTextManager::VTextManager constructor. More...
 
virtual ~VTextManager ()=default
 
 VTextManager (const VTextManager &text)
 
VTextManageroperator= (const VTextManager &text)
 
virtual int GetSpacing () const
 GetSpacing returns the vertical spacing between the lines. More...
 
void setFont (const QFont &font)
 SetFont set the text base font. More...
 
const QFont & GetFont () const
 GetFont returns the text base font. More...
 
void SetFontSize (int iFS)
 SetFontSize sets the font size. More...
 
void FitFontSize (qreal fW, qreal fH)
 VTextManager::FitFontSize sets the font size just big enough, so that the text fits into rectangle of size (fW, fH) More...
 
QList< TextLineGetAllSourceLines () const
 
int GetSourceLinesCount () const
 VTextManager::GetSourceLinesCount returns the number of input text lines. More...
 
const TextLineGetSourceLine (int i) const
 VTextManager::GetSourceLine returns the reference to i-th text line. More...
 
void Update (const QString &qsName, const VPieceLabelData &data)
 VTextManager::Update updates the text lines with detail data. More...
 
void Update (VAbstractPattern *pDoc)
 VTextManager::Update updates the text lines with pattern info. More...
 

Private Attributes

QFont m_font
 
QList< TextLinem_liLines
 

Static Private Attributes

static QList< TextLinem_patternLabelLines = QList<TextLine>()
 

Detailed Description

The VTextManager class this class is used to determine whether a collection of text lines can fit into specified bounding box and with what font size.

Definition at line 65 of file vtextmanager.h.

Constructor & Destructor Documentation

◆ VTextManager() [1/2]

VTextManager::VTextManager ( )

VTextManager::VTextManager constructor.

Definition at line 183 of file vtextmanager.cpp.

◆ ~VTextManager()

virtual VTextManager::~VTextManager ( )
virtualdefault

◆ VTextManager() [2/2]

VTextManager::VTextManager ( const VTextManager text)

Definition at line 188 of file vtextmanager.cpp.

Member Function Documentation

◆ FitFontSize()

void VTextManager::FitFontSize ( qreal  fW,
qreal  fH 
)

VTextManager::FitFontSize sets the font size just big enough, so that the text fits into rectangle of size (fW, fH)

Parameters
fWrectangle width
fHrectangle height

Definition at line 280 of file vtextmanager.cpp.

References TextLine::bold, GetSourceLine(), GetSourceLinesCount(), TextLine::italic, m_font, TextLine::m_iFontSize, TextLine::m_text, MIN_FONT_SIZE, and SetFontSize().

Referenced by VTextGraphicsItem::correctLabel().

◆ GetAllSourceLines()

QList< TextLine > VTextManager::GetAllSourceLines ( ) const

Definition at line 245 of file vtextmanager.cpp.

References m_liLines.

Referenced by operator=().

◆ GetFont()

const QFont & VTextManager::GetFont ( ) const

GetFont returns the text base font.

Returns
text base font

Definition at line 229 of file vtextmanager.cpp.

References m_font.

Referenced by VLayoutPiece::createLabelItem(), VTextGraphicsItem::getFontSize(), VTextGraphicsItem::mouseReleaseEvent(), operator=(), and VTextGraphicsItem::paint().

◆ GetSourceLine()

const TextLine & VTextManager::GetSourceLine ( int  i) const

VTextManager::GetSourceLine returns the reference to i-th text line.

Parameters
iindex of the requested line
Returns
reference to the requested TextLine object

Definition at line 266 of file vtextmanager.cpp.

References m_liLines.

Referenced by VLayoutPiece::createLabelItem(), FitFontSize(), VTextGraphicsItem::paint(), and anonymous_namespace{vlayoutpiece.cpp}::PieceLabelText().

◆ GetSourceLinesCount()

int VTextManager::GetSourceLinesCount ( ) const

VTextManager::GetSourceLinesCount returns the number of input text lines.

Returns
number of text lines that were added to the list by calling AddLine

Definition at line 255 of file vtextmanager.cpp.

References m_liLines.

Referenced by VLayoutPiece::createLabelItem(), FitFontSize(), VTextGraphicsItem::getTextLines(), VTextGraphicsItem::paint(), and anonymous_namespace{vlayoutpiece.cpp}::PieceLabelText().

◆ GetSpacing()

int VTextManager::GetSpacing ( ) const
virtual

GetSpacing returns the vertical spacing between the lines.

Returns
spacing

Definition at line 209 of file vtextmanager.cpp.

Referenced by VLayoutPiece::createLabelItem(), and VTextGraphicsItem::paint().

◆ operator=()

VTextManager & VTextManager::operator= ( const VTextManager text)

Definition at line 193 of file vtextmanager.cpp.

References GetAllSourceLines(), GetFont(), m_font, and m_liLines.

◆ setFont()

void VTextManager::setFont ( const QFont &  font)

SetFont set the text base font.

Parameters
fonttext base font

Definition at line 219 of file vtextmanager.cpp.

References m_font.

Referenced by VTextGraphicsItem::setFont().

◆ SetFontSize()

void VTextManager::SetFontSize ( int  iFS)

SetFontSize sets the font size.

Parameters
iFSfont size in pixels

Definition at line 239 of file vtextmanager.cpp.

References m_font, and MIN_FONT_SIZE.

Referenced by FitFontSize().

◆ Update() [1/2]

void VTextManager::Update ( const QString &  qsName,
const VPieceLabelData data 
)

◆ Update() [2/2]

Member Data Documentation

◆ m_font

QFont VTextManager::m_font
private

Definition at line 90 of file vtextmanager.h.

Referenced by FitFontSize(), GetFont(), operator=(), setFont(), and SetFontSize().

◆ m_liLines

QList<TextLine> VTextManager::m_liLines
private

◆ m_patternLabelLines

QList< TextLine > VTextManager::m_patternLabelLines = QList<TextLine>()
staticprivate

Definition at line 93 of file vtextmanager.h.

Referenced by Update().


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