31 #include <QFontMetrics>
32 #include <QLatin1String>
33 #include <QRegularExpression>
34 #include <QApplication>
37 #include "../ifc/xml/vabstractpattern.h"
38 #include "../vpatterndb/floatItemData/vpiecelabeldata.h"
39 #include "../vmisc/vabstractapplication.h"
40 #include "../vmisc/vmath.h"
41 #include "../vpatterndb/vcontainer.h"
53 m_eAlign(Qt::AlignCenter)
69 QLocale locale(
qApp->Settings()->GetLocale());
72 placeholders.insert(
pl_date, date);
75 placeholders.insert(
pl_time, time);
81 placeholders.insert(
pl_pExt, QString(
"val"));
82 placeholders.insert(
pl_pFileName, QFileInfo(
qApp->getFilePath()).baseName());
101 placeholders.insert(
pl_size, curSize);
102 placeholders.insert(
pl_height, curHeight);
103 placeholders.insert(
pl_mExt, mExt);
115 placeholders.insert(
pl_mFabric, QObject::tr(
"Fabric"));
116 placeholders.insert(
pl_mLining, QObject::tr(
"Lining"));
119 placeholders.insert(
pl_wCut, QObject::tr(
"Cut"));
138 placeholders[
pl_wOnFold] = QObject::tr(
"on fold");
146 auto i = placeholders.constBegin();
147 while (i != placeholders.constEnd())
149 line.replace(per+i.key()+per, i.value());
160 for (
int i=0; i < lines.size(); ++i)
162 if (not lines.at(i).line.isEmpty())
165 tl.
m_text = lines.at(i).line;
166 tl.
m_eAlign =
static_cast<Qt::Alignment
>(lines.at(i).alignment);
168 tl.
bold = lines.at(i).bold;
169 tl.
italic = lines.at(i).italic;
184 : m_font(), m_liLines()
189 : m_font(text.GetFont()), m_liLines(text.GetAllSourceLines())
303 fnt.setBold(tl.
bold);
305 QFontMetrics fm(fnt);
306 const int iTW = fm.horizontalAdvance(tl.
m_text);
316 fnt.setBold(maxLine.
bold);
317 fnt.setItalic(maxLine.
italic);
324 QFontMetrics fm(fnt);
325 lineLength = fm.horizontalAdvance(maxLine.
m_text);
348 for (
int i=0; i<lines.size(); ++i)
375 for (
int i=0; i<lines.size(); ++i)
bool GetPatternWasChanged() const
QString GetCompanyName() const
QVector< VLabelTemplateLine > getPatternLabelTemplate() const
QString GetLabelDateFormat() const
QString GetPatternName() const
QString GetPatternNumber() const
void SetPatternWasChanged(bool changed)
QString GetCustomerName() const
QString GetLabelTimeFormat() const
static qreal height()
height return height
static qreal size()
size return size
The VPieceLabelData class holds some information about a single piece like letter,...
QString GetOrientation() const
QVector< VLabelTemplateLine > GetLabelTemplate() const
QString GetRotationWay() const
QString GetAnnotation() const
QString GetLetter() const
QString GetFoldPosition() const
The VTextManager class this class is used to determine whether a collection of text lines can fit int...
VTextManager & operator=(const VTextManager &text)
int GetSourceLinesCount() const
VTextManager::GetSourceLinesCount returns the number of input text lines.
virtual int GetSpacing() const
GetSpacing returns the vertical spacing between the lines.
VTextManager()
VTextManager::VTextManager constructor.
const QFont & GetFont() const
GetFont returns the text base font.
const TextLine & GetSourceLine(int i) const
VTextManager::GetSourceLine returns the reference to i-th text line.
QList< TextLine > GetAllSourceLines() const
void Update(const QString &qsName, const VPieceLabelData &data)
VTextManager::Update updates the text lines with detail data.
QList< TextLine > m_liLines
static QList< TextLine > m_patternLabelLines
void setFont(const QFont &font)
SetFont set the text base font.
void FitFontSize(qreal fW, qreal fH)
VTextManager::FitFontSize sets the font size just big enough, so that the text fits into rectangle of...
void SetFontSize(int iFS)
SetFontSize sets the font size.
const QString pl_customer
const QString pl_pFoldPosition
const QString pl_pQuantity
const QString pl_mFileName
const QString pl_patternName
const QString pl_pAnnotation
const QString pl_patternNumber
const QString pl_pFileName
const QString pl_mInterfacing
const QString pl_pOrientation
const QString pl_pRotation
const QString pl_mInterlining
QList< TextLine > PrepareLines(const QVector< VLabelTemplateLine > &lines)
void InitPiecePlaceholders(QMap< QString, QString > &placeholders, const QString &name, const VPieceLabelData &data)
QString ReplacePlaceholders(const QMap< QString, QString > &placeholders, QString line)
QMap< QString, QString > PreparePlaceholders(const VAbstractPattern *doc)
The TextLine struct holds the information about one text line.
TextLine()
TextLine::TextLine default constructor.