Labels with pattern info are now displayed in the Layout mode as well. Maybe needs a little bit of refactoring (the label styles and texts are now set up in two different places (VToolDetail and VLayoutDetail), I think this should be unified

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-07-19 13:47:21 +02:00
parent 6516fb3204
commit 1759d4314f
7 changed files with 206 additions and 30 deletions

View File

@ -477,12 +477,20 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *de
const VPatternPieceData& data = d.GetPatternPieceData(); const VPatternPieceData& data = d.GetPatternPieceData();
if (data.IsVisible() == true) if (data.IsVisible() == true)
{ {
det.SetDetail(d.getName(), data); det.SetDetail(d.getName(), data, qApp->font());
} }
const VPatternInfoGeometry& geom = d.GetPatternInfo(); const VPatternInfoGeometry& geom = d.GetPatternInfo();
if (geom.IsVisible() == true) if (geom.IsVisible() == true)
{ {
det.SetPatternInfoPoints(geom.GetPos(), geom.GetLabelWidth(), geom.GetLabelHeight(), geom.GetRotation()); VAbstractPattern* pDoc = qApp->getCurrentDocument();
QDate date;
if (pDoc->IsDateVisible() == true)
{
date = pDoc->GetCreationDate();
}
det.SetPatternInfo(pDoc->GetPatternName(), pDoc->GetPatternNumber(), pDoc->GetPatternSize(),
pDoc->GetCompanyName(), pDoc->GetCustomerName(), date, geom, qApp->font());
qApp->getCurrentDocument();
} }
det.setWidth(qApp->toPixel(d.getWidth())); det.setWidth(qApp->toPixel(d.getWidth()));
det.CreateTextItems(); det.CreateTextItems();

View File

@ -33,8 +33,8 @@
#include <QPainterPath> #include <QPainterPath>
#include <QFont> #include <QFont>
#include <QFontMetrics> #include <QFontMetrics>
#include <QApplication>
#include <QBrush> #include <QBrush>
#include <stdio.h>
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h" # include "../vmisc/vmath.h"
@ -46,12 +46,13 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail::VLayoutDetail() VLayoutDetail::VLayoutDetail()
:VAbstractDetail(), d(new VLayoutDetailData), m_tmDetail(), m_liPP() :VAbstractDetail(), d(new VLayoutDetailData), m_tmDetail(), m_tmPattern(), m_liPP()
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail::VLayoutDetail(const VLayoutDetail &detail) VLayoutDetail::VLayoutDetail(const VLayoutDetail &detail)
:VAbstractDetail(detail), d(detail.d), m_tmDetail(detail.m_tmDetail), m_liPP(detail.m_liPP) :VAbstractDetail(detail), d(detail.d), m_tmDetail(detail.m_tmDetail), m_tmPattern(detail.m_tmPattern),
m_liPP(detail.m_liPP)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -64,6 +65,7 @@ VLayoutDetail &VLayoutDetail::operator=(const VLayoutDetail &detail)
VAbstractDetail::operator=(detail); VAbstractDetail::operator=(detail);
d = detail.d; d = detail.d;
m_tmDetail = detail.m_tmDetail; m_tmDetail = detail.m_tmDetail;
m_tmPattern = detail.m_tmPattern;
m_liPP = detail.m_liPP; m_liPP = detail.m_liPP;
return *this; return *this;
} }
@ -119,7 +121,7 @@ QVector<QPointF> VLayoutDetail::GetLayoutAllowencePoints() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& data) void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& data, const QFont &font)
{ {
d->detailData = data; d->detailData = data;
qreal dAng = qDegreesToRadians(data.GetRotation()); qreal dAng = qDegreesToRadians(data.GetRotation());
@ -130,12 +132,13 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
<< QPointF(ptPos.x() + data.GetLabelWidth(), ptPos.y() + data.GetLabelHeight()) << QPointF(ptPos.x() + data.GetLabelWidth(), ptPos.y() + data.GetLabelHeight())
<< QPointF(ptPos.x(), ptPos.y() + data.GetLabelHeight()); << QPointF(ptPos.x(), ptPos.y() + data.GetLabelHeight());
for (int i = 0; i < v.count(); ++i) for (int i = 0; i < v.count(); ++i)
{
v[i] = RotatePoint(ptCenter, v[i], dAng); v[i] = RotatePoint(ptCenter, v[i], dAng);
}
d->detailLabel = RoundPoints(v); d->detailLabel = RoundPoints(v);
// generate text // generate text
QFont fnt = QApplication::font(); m_tmDetail.SetFont(font);
m_tmDetail.SetFont(fnt);
m_tmDetail.SetFontSize(data.GetFontSize()); m_tmDetail.SetFontSize(data.GetFontSize());
m_tmDetail.Clear(); m_tmDetail.Clear();
TextLine tl; TextLine tl;
@ -153,7 +156,9 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
if (qsName.isEmpty() == false) if (qsName.isEmpty() == false)
{ {
tl.m_qsText = qsName; tl.m_qsText = qsName;
tl.m_eAlign = Qt::AlignCenter;
tl.m_eFontWeight = QFont::DemiBold; tl.m_eFontWeight = QFont::DemiBold;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 2; tl.m_iFontSize = 2;
m_tmDetail.AddLine(tl); m_tmDetail.AddLine(tl);
} }
@ -164,6 +169,7 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
qslPlace << "" << " on Fold"; qslPlace << "" << " on Fold";
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter; tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal; tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0; tl.m_iFontSize = 0;
for (int i = 0; i < data.GetMCPCount(); ++i) for (int i = 0; i < data.GetMCPCount(); ++i)
{ {
@ -175,26 +181,98 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
} }
} }
// will generate the lines of text // will generate the lines of text
m_tmDetail.IsBigEnough(data.GetLabelWidth(), data.GetLabelHeight(), data.GetFontSize()); m_tmDetail.SetFontSize(data.GetFontSize());
m_tmDetail.FitFontSize(data.GetLabelWidth(), data.GetLabelHeight());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VLayoutDetail::GetPatternInfoPoints() const void VLayoutDetail::SetPatternInfo(const QString& qsPattern, const QString& qsNumber, const QString& qsSize,
const QString& qsCompany, const QString& qsCustomer, const QDate& date,
const VPatternInfoGeometry& geom, const QFont &font)
{ {
return d->patternInfo; d->patternGeom = geom;
} qreal dAng = qDegreesToRadians(geom.GetRotation());
QPointF ptCenter(geom.GetPos().x() + geom.GetLabelWidth()/2, geom.GetPos().y() + geom.GetLabelHeight()/2);
//--------------------------------------------------------------------------------------------------------------------- QPointF ptPos = geom.GetPos();
void VLayoutDetail::SetPatternInfoPoints(const QPointF& ptPos, qreal dWidth, qreal dHeight, qreal dRot)
{
qreal dAng = qDegreesToRadians(dRot);
QPointF ptCenter(ptPos.x() + dWidth/2, ptPos.y() + dHeight/2);
QVector<QPointF> v; QVector<QPointF> v;
v << ptPos << QPointF(ptPos.x() + dWidth, ptPos.y()) << QPointF(ptPos.x() + dWidth, ptPos.y() + dHeight) v << ptPos << QPointF(ptPos.x() + geom.GetLabelWidth(), ptPos.y())
<< QPointF(ptPos.x(), ptPos.y() + dHeight); << QPointF(ptPos.x() + geom.GetLabelWidth(), ptPos.y() + geom.GetLabelHeight())
<< QPointF(ptPos.x(), ptPos.y() + geom.GetLabelHeight());
for (int i = 0; i < v.count(); ++i) for (int i = 0; i < v.count(); ++i)
{
v[i] = RotatePoint(ptCenter, v[i], dAng); v[i] = RotatePoint(ptCenter, v[i], dAng);
}
d->patternInfo = RoundPoints(v); d->patternInfo = RoundPoints(v);
// Generate text
m_tmPattern.SetFont(font);
m_tmPattern.SetFontSize(geom.GetFontSize());
m_tmPattern.Clear();
TextLine tl;
// Company name
tl.m_qsText = qsCompany;
if (tl.m_qsText.isEmpty() == false)
{
tl.m_eAlign = Qt::AlignCenter;
tl.m_eFontWeight = QFont::DemiBold;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 4;
m_tmPattern.AddLine(tl);
}
// Pattern name
tl.m_qsText = qsPattern;
if (tl.m_qsText.isEmpty() == false)
{
tl.m_eAlign = Qt::AlignCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 2;
m_tmPattern.AddLine(tl);
}
// Pattern number
tl.m_qsText = qsNumber;
if (tl.m_qsText.isEmpty() == false)
{
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0;
m_tmPattern.AddLine(tl);
}
// Customer name
tl.m_qsText = qsCustomer;
if (tl.m_qsText.isEmpty() == false)
{
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleItalic;
tl.m_iFontSize = 0;
m_tmPattern.AddLine(tl);
}
// Size
tl.m_qsText = qsSize;
if (tl.m_qsText.isEmpty() == false)
{
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0;
m_tmPattern.AddLine(tl);
}
// Creation date
if (date.isValid() == true)
{
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0;
QStringList qslDate = date.toString(Qt::SystemLocaleLongDate).split(", ");
tl.m_qsText = qslDate.last();
m_tmPattern.AddLine(tl);
}
// generate lines of text
m_tmPattern.SetFontSize(geom.GetFontSize());
m_tmPattern.FitFontSize(geom.GetLabelWidth(), geom.GetLabelHeight());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -548,6 +626,7 @@ void VLayoutDetail::ClearTextItems()
void VLayoutDetail::CreateTextItems() void VLayoutDetail::CreateTextItems()
{ {
ClearTextItems(); ClearTextItems();
// first add detail texts
if (d->detailLabel.count() > 0) if (d->detailLabel.count() > 0)
{ {
QVector<QPointF> points = Map(Mirror(d->detailLabel)); QVector<QPointF> points = Map(Mirror(d->detailLabel));
@ -587,6 +666,47 @@ void VLayoutDetail::CreateTextItems()
dY += m_tmDetail.GetSpacing(); dY += m_tmDetail.GetSpacing();
} }
} }
// and then add pattern texts
if (d->patternInfo.count() > 0)
{
QVector<QPointF> points = Map(Mirror(d->patternInfo));
points.push_back(points.at(0));
qreal dAng = qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x());
qreal dW = GetDistance(points.at(0), points.at(1));
qreal dY = 0;
qreal dX;
printf("Pattern lines %d %d\n", m_tmPattern.GetCount(), m_tmPattern.GetSourceLineCount());
for (int i = 0; i < m_tmPattern.GetCount(); ++i)
{
const TextLine& tl = m_tmPattern.GetLine(i);
QFont fnt = m_tmPattern.GetFont();
fnt.setPixelSize(m_tmPattern.GetFont().pixelSize() + tl.m_iFontSize);
fnt.setWeight(tl.m_eFontWeight);
fnt.setStyle(tl.m_eStyle);
dY += tl.m_iHeight;
QMatrix mat;
mat.translate(points.at(0).x(), points.at(0).y());
mat.rotate(qRadiansToDegrees(dAng));
QFontMetrics fm(fnt);
if ((tl.m_eAlign & Qt::AlignLeft) > 0)
{
dX = 0;
}
else if ((tl.m_eAlign & Qt::AlignHCenter) > 0)
{
dX = (dW - fm.width(tl.m_qsText))/2;
}
else
{
dX = dW - fm.width(tl.m_qsText);
}
QPainterPath path;
path.addText(dX, dY - (fm.height() - fm.ascent())/2, fnt, tl.m_qsText);
m_liPP << mat.map(path);
dY += m_tmPattern.GetSpacing();
}
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -605,7 +725,15 @@ QGraphicsItem* VLayoutDetail::GetTextItem(int i) const
if (d->mirror == true) if (d->mirror == true)
{ {
QVector<QPointF> points = Map(Mirror(d->detailLabel)); QVector<QPointF> points;
if (i < m_tmDetail.GetCount())
{
points = Map(Mirror(d->detailLabel));
}
else
{
points = Map(Mirror(d->patternInfo));
}
QPointF ptCenter = (points.at(1) + points.at(3))/2; QPointF ptCenter = (points.at(1) + points.at(3))/2;
qreal dRot = qRadiansToDegrees(qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x())); qreal dRot = qRadiansToDegrees(qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x()));
@ -619,6 +747,7 @@ QGraphicsItem* VLayoutDetail::GetTextItem(int i) const
t.translate(-ptCenter.x(), -ptCenter.y()); t.translate(-ptCenter.x(), -ptCenter.y());
path = t.map(path); path = t.map(path);
} }
item->setPath(path); item->setPath(path);
item->setBrush(QBrush(Qt::black)); item->setBrush(QBrush(Qt::black));
return item; return item;

View File

@ -31,10 +31,12 @@
#include "vabstractdetail.h" #include "vabstractdetail.h"
#include "../vpatterndb/vpatternpiecedata.h" #include "../vpatterndb/vpatternpiecedata.h"
#include "../vpatterndb/vpatterninfogeometry.h"
#include "../vtools/tools/vtextmanager.h" #include "../vtools/tools/vtextmanager.h"
#include <QMatrix> #include <QMatrix>
#include <QPointF> #include <QPointF>
#include <QDate>
class VLayoutDetailData; class VLayoutDetailData;
class QGraphicsItem; class QGraphicsItem;
@ -56,10 +58,11 @@ public:
QVector<QPointF> GetLayoutAllowencePoints() const; QVector<QPointF> GetLayoutAllowencePoints() const;
void SetLayoutAllowencePoints(); void SetLayoutAllowencePoints();
void SetDetail(const QString &qsName, const VPatternPieceData& data); void SetDetail(const QString &qsName, const VPatternPieceData& data, const QFont& font);
QVector<QPointF> GetPatternInfoPoints() const; void SetPatternInfo(const QString& qsPattern, const QString& qsNumber, const QString& qsSize,
void SetPatternInfoPoints(const QPointF& ptPos, qreal dWidth, qreal dHeight, qreal dRot); const QString& qsCompany, const QString& qsCustomer, const QDate& date,
const VPatternInfoGeometry& geom, const QFont& font);
QTransform GetMatrix() const; QTransform GetMatrix() const;
void SetMatrix(const QTransform &matrix); void SetMatrix(const QTransform &matrix);
@ -95,6 +98,7 @@ public:
private: private:
QSharedDataPointer<VLayoutDetailData> d; QSharedDataPointer<VLayoutDetailData> d;
VTextManager m_tmDetail; VTextManager m_tmDetail;
VTextManager m_tmPattern;
QList<QPainterPath> m_liPP; QList<QPainterPath> m_liPP;
QVector<QPointF> Map(const QVector<QPointF> &points) const; QVector<QPointF> Map(const QVector<QPointF> &points) const;

View File

@ -35,6 +35,7 @@
#include <QTransform> #include <QTransform>
#include "../vpatterndb/vpatternpiecedata.h" #include "../vpatterndb/vpatternpiecedata.h"
#include "../vpatterndb/vpatterninfogeometry.h"
#ifdef Q_CC_GNU #ifdef Q_CC_GNU
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -47,14 +48,14 @@ public:
VLayoutDetailData() VLayoutDetailData()
:contour(QVector<QPointF>()), seamAllowence(QVector<QPointF>()), layoutAllowence(QVector<QPointF>()), :contour(QVector<QPointF>()), seamAllowence(QVector<QPointF>()), layoutAllowence(QVector<QPointF>()),
matrix(QMatrix()), layoutWidth(0), mirror(false), detailLabel(QVector<QPointF>()), matrix(QMatrix()), layoutWidth(0), mirror(false), detailLabel(QVector<QPointF>()),
patternInfo(QVector<QPointF>()), detailData() patternInfo(QVector<QPointF>()), detailData(), patternGeom()
{} {}
VLayoutDetailData(const VLayoutDetailData &detail) VLayoutDetailData(const VLayoutDetailData &detail)
:QSharedData(detail), contour(detail.contour), seamAllowence(detail.seamAllowence), :QSharedData(detail), contour(detail.contour), seamAllowence(detail.seamAllowence),
layoutAllowence(detail.layoutAllowence), matrix(detail.matrix), layoutAllowence(detail.layoutAllowence), matrix(detail.matrix),
layoutWidth(detail.layoutWidth), mirror(detail.mirror), detailLabel(detail.detailLabel), layoutWidth(detail.layoutWidth), mirror(detail.mirror), detailLabel(detail.detailLabel),
patternInfo(detail.patternInfo), detailData(detail.detailData) patternInfo(detail.patternInfo), detailData(detail.detailData), patternGeom(detail.patternGeom)
{} {}
~VLayoutDetailData() {} ~VLayoutDetailData() {}
@ -76,12 +77,14 @@ public:
bool mirror; bool mirror;
/** @brief detail label rectangle */ /** @brief detailLabel detail label rectangle */
QVector<QPointF> detailLabel; QVector<QPointF> detailLabel;
/** @brief pattern info rectangle */ /** @brief patternInfo pattern info rectangle */
QVector<QPointF> patternInfo; QVector<QPointF> patternInfo;
/** @brief detail data */ /** @brief detailData detail data */
VPatternPieceData detailData; VPatternPieceData detailData;
/** @brief patternGeom pattern geometry */
VPatternInfoGeometry patternGeom;
private: private:
VLayoutDetailData &operator=(const VLayoutDetailData &) Q_DECL_EQ_DELETE; VLayoutDetailData &operator=(const VLayoutDetailData &) Q_DECL_EQ_DELETE;

View File

@ -96,6 +96,21 @@ bool VTextManager::IsBigEnough(qreal fW, qreal fH, int iFontSize)
return iY < fH; return iY < fH;
} }
//---------------------------------------------------------------------------------------------------------------------
void VTextManager::FitFontSize(qreal fW, qreal fH)
{
int iFontSize = GetFont().pixelSize();
while (IsBigEnough(fW, fH, iFontSize) == true && iFontSize <= MAX_FONT_SIZE)
{
++iFontSize;
}
while (IsBigEnough(fW, fH, iFontSize) == false && iFontSize >= MIN_FONT_SIZE)
{
--iFontSize;
}
SetFontSize(iFontSize);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList VTextManager::SplitString(const QString &qs, qreal fW, const QFontMetrics &fm) QStringList VTextManager::SplitString(const QString &qs, qreal fW, const QFontMetrics &fm)
{ {

View File

@ -35,6 +35,7 @@ public:
int GetSourceLineCount() const; int GetSourceLineCount() const;
const TextLine& GetLine(int i) const; const TextLine& GetLine(int i) const;
bool IsBigEnough(qreal fW, qreal fH, int iFontSize); bool IsBigEnough(qreal fW, qreal fH, int iFontSize);
void FitFontSize(qreal fW, qreal fH);
protected: protected:
QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm); QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);

View File

@ -704,6 +704,7 @@ void VToolDetail::UpdateLabel()
{ {
tl.m_eAlign = Qt::AlignCenter; tl.m_eAlign = Qt::AlignCenter;
tl.m_eFontWeight = QFont::DemiBold; tl.m_eFontWeight = QFont::DemiBold;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 2; tl.m_iFontSize = 2;
dataLabel->AddLine(tl); dataLabel->AddLine(tl);
} }
@ -711,6 +712,7 @@ void VToolDetail::UpdateLabel()
// MCP // MCP
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter; tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal; tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0; tl.m_iFontSize = 0;
for (int i = 0; i < data.GetMCPCount(); ++i) for (int i = 0; i < data.GetMCPCount(); ++i)
{ {
@ -784,7 +786,9 @@ void VToolDetail::UpdatePatternInfo()
tl.m_qsText = doc->GetPatternName(); tl.m_qsText = doc->GetPatternName();
if (tl.m_qsText.isEmpty() == false) if (tl.m_qsText.isEmpty() == false)
{ {
tl.m_eAlign = Qt::AlignCenter;
tl.m_eFontWeight = QFont::Normal; tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 2; tl.m_iFontSize = 2;
patternInfo->AddLine(tl); patternInfo->AddLine(tl);
} }
@ -793,8 +797,10 @@ void VToolDetail::UpdatePatternInfo()
tl.m_qsText = doc->GetPatternNumber(); tl.m_qsText = doc->GetPatternNumber();
if (tl.m_qsText.isEmpty() == false) if (tl.m_qsText.isEmpty() == false)
{ {
tl.m_iFontSize = 0;
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter; tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0;
patternInfo->AddLine(tl); patternInfo->AddLine(tl);
} }
@ -802,7 +808,10 @@ void VToolDetail::UpdatePatternInfo()
tl.m_qsText = doc->GetCustomerName(); tl.m_qsText = doc->GetCustomerName();
if (tl.m_qsText.isEmpty() == false) if (tl.m_qsText.isEmpty() == false)
{ {
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleItalic; tl.m_eStyle = QFont::StyleItalic;
tl.m_iFontSize = 0;
patternInfo->AddLine(tl); patternInfo->AddLine(tl);
} }
@ -810,13 +819,20 @@ void VToolDetail::UpdatePatternInfo()
tl.m_qsText = doc->GetPatternSize(); tl.m_qsText = doc->GetPatternSize();
if (tl.m_qsText.isEmpty() == false) if (tl.m_qsText.isEmpty() == false)
{ {
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal; tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0;
patternInfo->AddLine(tl); patternInfo->AddLine(tl);
} }
// Creation date // Creation date
if (doc->IsDateVisible() == true) if (doc->IsDateVisible() == true)
{ {
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0;
QStringList qslDate = doc->GetCreationDate().toString(Qt::SystemLocaleLongDate).split(", "); QStringList qslDate = doc->GetCreationDate().toString(Qt::SystemLocaleLongDate).split(", ");
tl.m_qsText = qslDate.last(); tl.m_qsText = qslDate.last();
patternInfo->AddLine(tl); patternInfo->AddLine(tl);