Merge with feature.

Fixed issue #589. Error: Valentina lock up if not enough space for label.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-12-15 11:29:56 +02:00
commit c2e038c57b
7 changed files with 116 additions and 126 deletions

View File

@ -47,6 +47,7 @@
- [#580] Extend the list of heights. - [#580] Extend the list of heights.
- [#582] Issue with standard path to shared data on Linux. - [#582] Issue with standard path to shared data on Linux.
- [#595] GapWidth affecting to the margins. - [#595] GapWidth affecting to the margins.
- [#589] Valentina lock up if not enough space for label.
# Version 0.4.6 # Version 0.4.6
- [#594] Broken export on Mac. - [#594] Broken export on Mac.

View File

@ -148,15 +148,10 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
// generate text // generate text
d->m_tmDetail.SetFont(font); d->m_tmDetail.SetFont(font);
int iFS = data.GetFontSize(); d->m_tmDetail.SetFontSize(data.GetFontSize());
if (iFS < MIN_FONT_SIZE)
{
iFS = MIN_FONT_SIZE;
}
d->m_tmDetail.SetFontSize(iFS);
d->m_tmDetail.Update(qsName, data); d->m_tmDetail.Update(qsName, data);
// this will generate the lines of text // this will generate the lines of text
d->m_tmDetail.SetFontSize(iFS); d->m_tmDetail.SetFontSize(data.GetFontSize());
d->m_tmDetail.FitFontSize(data.GetLabelWidth(), data.GetLabelHeight()); d->m_tmDetail.FitFontSize(data.GetLabelWidth(), data.GetLabelHeight());
} }
@ -180,17 +175,12 @@ void VLayoutDetail::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternI
// Generate text // Generate text
d->m_tmPattern.SetFont(font); d->m_tmPattern.SetFont(font);
int iFS = geom.GetFontSize(); d->m_tmPattern.SetFontSize(geom.GetFontSize());
if (iFS < MIN_FONT_SIZE)
{
iFS = MIN_FONT_SIZE;
}
d->m_tmPattern.SetFontSize(iFS);
d->m_tmPattern.Update(pDoc, dSize, dHeight); d->m_tmPattern.Update(pDoc, dSize, dHeight);
// generate lines of text // generate lines of text
d->m_tmPattern.SetFontSize(iFS); d->m_tmPattern.SetFontSize(geom.GetFontSize());
d->m_tmPattern.FitFontSize(geom.GetLabelWidth(), geom.GetLabelHeight()); d->m_tmPattern.FitFontSize(geom.GetLabelWidth(), geom.GetLabelHeight());
} }
@ -581,18 +571,20 @@ void VLayoutDetail::CreateTextItems()
fnt.setPixelSize(d->m_tmDetail.GetFont().pixelSize() + tl.m_iFontSize); fnt.setPixelSize(d->m_tmDetail.GetFont().pixelSize() + tl.m_iFontSize);
fnt.setWeight(tl.m_eFontWeight); fnt.setWeight(tl.m_eFontWeight);
fnt.setStyle(tl.m_eStyle); fnt.setStyle(tl.m_eStyle);
dY += tl.m_iHeight;
QFontMetrics fm(fnt);
dY += fm.height();
// check if the next line will go out of bounds // check if the next line will go out of bounds
if (dY > dH) if (dY > dH)
{ {
break; break;
} }
QFontMetrics fm(fnt);
QString qsText = tl.m_qsText; QString qsText = tl.m_qsText;
if (fm.width(qsText) > dW) if (fm.width(qsText) > dW)
{ {
qsText = fm.elidedText(qsText, Qt::ElideRight, dW); qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast<int>(dW));
} }
// find the correct horizontal offset, depending on the alignment flag // find the correct horizontal offset, depending on the alignment flag
if ((tl.m_eAlign & Qt::AlignLeft) > 0) if ((tl.m_eAlign & Qt::AlignLeft) > 0)
@ -636,17 +628,19 @@ void VLayoutDetail::CreateTextItems()
fnt.setPixelSize(d->m_tmPattern.GetFont().pixelSize() + tl.m_iFontSize); fnt.setPixelSize(d->m_tmPattern.GetFont().pixelSize() + tl.m_iFontSize);
fnt.setWeight(tl.m_eFontWeight); fnt.setWeight(tl.m_eFontWeight);
fnt.setStyle(tl.m_eStyle); fnt.setStyle(tl.m_eStyle);
dY += tl.m_iHeight;
QFontMetrics fm(fnt);
dY += fm.height();
if (dY > dH) if (dY > dH)
{ {
break; break;
} }
QFontMetrics fm(fnt);
QString qsText = tl.m_qsText; QString qsText = tl.m_qsText;
if (fm.width(qsText) > dW) if (fm.width(qsText) > dW)
{ {
qsText = fm.elidedText(qsText, Qt::ElideRight, dW); qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast<int>(dW));
} }
if ((tl.m_eAlign & Qt::AlignLeft) > 0) if ((tl.m_eAlign & Qt::AlignLeft) > 0)
{ {

View File

@ -32,11 +32,11 @@
#include <QLatin1String> #include <QLatin1String>
#include <QRegularExpression> #include <QRegularExpression>
#include <QApplication> #include <QApplication>
#include <QtMath>
#include "../ifc/xml/vabstractpattern.h" #include "../ifc/xml/vabstractpattern.h"
#include "../vpatterndb/vpatternpiecedata.h" #include "../vpatterndb/vpatternpiecedata.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "../vmisc/vmath.h"
#include "vtextmanager.h" #include "vtextmanager.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -44,8 +44,11 @@
* @brief TextLine::TextLine default constructor * @brief TextLine::TextLine default constructor
*/ */
TextLine::TextLine() TextLine::TextLine()
:m_qsText(), m_iFontSize(MIN_FONT_SIZE), m_eFontWeight(QFont::Normal), m_eStyle(QFont::StyleNormal), : m_qsText(),
m_eAlign(Qt::AlignCenter), m_iHeight(0) m_iFontSize(MIN_FONT_SIZE),
m_eFontWeight(QFont::Normal),
m_eStyle(QFont::StyleNormal),
m_eAlign(Qt::AlignCenter)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -117,14 +120,7 @@ const QFont& VTextManager::GetFont() const
*/ */
void VTextManager::SetFontSize(int iFS) void VTextManager::SetFontSize(int iFS)
{ {
if (iFS < MIN_FONT_SIZE) iFS < MIN_FONT_SIZE ? m_font.setPixelSize(MIN_FONT_SIZE) : m_font.setPixelSize(iFS);
{
m_font.setPixelSize(MIN_FONT_SIZE);
}
else
{
m_font.setPixelSize(iFS);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -172,7 +168,7 @@ const TextLine& VTextManager::GetSourceLine(int i) const
{ {
Q_ASSERT(i >= 0); Q_ASSERT(i >= 0);
Q_ASSERT(i < m_liLines.count()); Q_ASSERT(i < m_liLines.count());
return m_liLines[i]; return m_liLines.at(i);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -193,7 +189,7 @@ void VTextManager::FitFontSize(qreal fW, qreal fH)
// get ratio between char width and height // get ratio between char width and height
int iMaxLen = 0; int iMaxLen = 0;
int iTW; TextLine maxLine;
QFont fnt; QFont fnt;
for (int i = 0; i < GetSourceLinesCount(); ++i) for (int i = 0; i < GetSourceLinesCount(); ++i)
{ {
@ -203,23 +199,30 @@ void VTextManager::FitFontSize(qreal fW, qreal fH)
fnt.setWeight(tl.m_eFontWeight); fnt.setWeight(tl.m_eFontWeight);
fnt.setStyle(tl.m_eStyle); fnt.setStyle(tl.m_eStyle);
QFontMetrics fm(fnt); QFontMetrics fm(fnt);
iTW = fm.width(GetSourceLine(i).m_qsText); const int iTW = fm.width(tl.m_qsText);
if (iTW > iMaxLen) if (iTW > iMaxLen)
{ {
iMaxLen = iTW; iMaxLen = iTW;
maxLine = tl;
} }
} }
if (iMaxLen > fW) if (iMaxLen > fW)
{ {
iFS = qFloor(iFS*fW/iMaxLen); QFont fnt = m_font;
} fnt.setWeight(maxLine.m_eFontWeight);
iFS = qMax(MIN_FONT_SIZE, iFS); fnt.setStyle(maxLine.m_eStyle);
int iH = 4*iFS/3;
SetFontSize(iFS); int lineLength = 0;
for (int i = 0; i < GetSourceLinesCount(); ++i) do
{ {
m_liLines[i].m_iHeight = iH; --iFS;
fnt.setPixelSize(iFS + maxLine.m_iFontSize);
QFontMetrics fm(fnt);
lineLength = fm.width(maxLine.m_qsText);
} }
while (lineLength > fW && iFS > MIN_FONT_SIZE);
}
SetFontSize(iFS);
qDebug() << "Font size" << GetSourceLinesCount() << iFS; qDebug() << "Font size" << GetSourceLinesCount() << iFS;
} }

View File

@ -44,7 +44,7 @@ class QFontMetrics;
class VAbstractPattern; class VAbstractPattern;
class VPatternPieceData; class VPatternPieceData;
#define MIN_FONT_SIZE 12 #define MIN_FONT_SIZE 5
#define MAX_FONT_SIZE 128 #define MAX_FONT_SIZE 128
/** /**
@ -57,7 +57,6 @@ struct TextLine
QFont::Weight m_eFontWeight; QFont::Weight m_eFontWeight;
QFont::Style m_eStyle; QFont::Style m_eStyle;
Qt::Alignment m_eAlign; Qt::Alignment m_eAlign;
int m_iHeight;
TextLine(); TextLine();
}; };

View File

@ -49,12 +49,12 @@ class QWidget;
class VAbstractPattern; class VAbstractPattern;
class VPatternPieceData; class VPatternPieceData;
#define RESIZE_SQUARE 30 const qreal resizeSquare = (3./*mm*/ / 25.4) * PrintDPI;
#define ROTATE_CIRCLE 20 const qreal rotateCircle = (2./*mm*/ / 25.4) * PrintDPI;
#define ROTATE_RECT 60 #define ROTATE_RECT 60
#define ROTATE_ARC 50 #define ROTATE_ARC 50
#define MIN_W 120 const qreal minW = (4./*mm*/ / 25.4) * PrintDPI + resizeSquare;
#define MIN_H 60 const qreal minH = (4./*mm*/ / 25.4) * PrintDPI + resizeSquare;
#define INACTIVE_Z 2 #define INACTIVE_Z 2
#define ACTIVE_Z 10 #define ACTIVE_Z 10
@ -64,12 +64,21 @@ class VPatternPieceData;
* @param pParent pointer to the parent item * @param pParent pointer to the parent item
*/ */
VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem* pParent) VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem* pParent)
:QGraphicsObject(pParent), m_eMode(VTextGraphicsItem::mNormal), m_bReleased(false), : QGraphicsObject(pParent),
m_ptStartPos(), m_ptStart(), m_ptRotCenter(), m_szStart(), m_dRotation(0), m_dAngle(0), m_eMode(VTextGraphicsItem::mNormal),
m_rectResize(), m_iMinH(MIN_H), m_rectBoundingBox(), m_tm() m_bReleased(false),
m_ptStartPos(),
m_ptStart(),
m_ptRotCenter(),
m_szStart(),
m_dRotation(0),
m_dAngle(0),
m_rectResize(),
m_rectBoundingBox(),
m_tm()
{ {
m_rectBoundingBox.setTopLeft(QPointF(0, 0)); m_rectBoundingBox.setTopLeft(QPointF(0, 0));
SetSize(MIN_W, m_iMinH); SetSize(minW, minH);
setZValue(INACTIVE_Z); setZValue(INACTIVE_Z);
setAcceptHoverEvents(true); setAcceptHoverEvents(true);
} }
@ -101,7 +110,8 @@ void VTextGraphicsItem::SetFont(const QFont& fnt)
void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
Q_UNUSED(widget); Q_UNUSED(widget);
painter->fillRect(option->rect, QColor(251, 251, 175)); Q_UNUSED(option);
painter->fillRect(m_rectBoundingBox, QColor(251, 251, 175));
painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
painter->setPen(Qt::black); painter->setPen(Qt::black);
@ -112,25 +122,28 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
for (int i = 0; i < m_tm.GetSourceLinesCount(); ++i) for (int i = 0; i < m_tm.GetSourceLinesCount(); ++i)
{ {
const TextLine& tl = m_tm.GetSourceLine(i); const TextLine& tl = m_tm.GetSourceLine(i);
// check if the next line will go out of bounds
if (iY + tl.m_iHeight > boundingRect().height())
{
break;
}
fnt.setPixelSize(m_tm.GetFont().pixelSize() + tl.m_iFontSize); fnt.setPixelSize(m_tm.GetFont().pixelSize() + tl.m_iFontSize);
fnt.setWeight(tl.m_eFontWeight); fnt.setWeight(tl.m_eFontWeight);
fnt.setStyle(tl.m_eStyle); fnt.setStyle(tl.m_eStyle);
QString qsText = tl.m_qsText; QString qsText = tl.m_qsText;
QFontMetrics fm(fnt); QFontMetrics fm(fnt);
// check if the next line will go out of bounds
if (iY + fm.height() > boundingRect().height())
{
break;
}
if (fm.width(qsText) > iW) if (fm.width(qsText) > iW)
{ {
qsText = fm.elidedText(qsText, Qt::ElideRight, iW); qsText = fm.elidedText(qsText, Qt::ElideMiddle, iW);
} }
painter->setFont(fnt); painter->setFont(fnt);
painter->drawText(0, iY, iW, tl.m_iHeight, tl.m_eAlign, qsText); painter->drawText(0, iY, iW, fm.height(), tl.m_eAlign, qsText);
iY += tl.m_iHeight + m_tm.GetSpacing(); iY += fm.height() + m_tm.GetSpacing();
} }
// now draw the features specific to non-normal modes // now draw the features specific to non-normal modes
@ -145,13 +158,13 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
// draw the resize square // draw the resize square
painter->setPen(Qt::black); painter->setPen(Qt::black);
painter->setBrush(Qt::black); painter->setBrush(Qt::black);
painter->drawRect(m_rectResize); painter->drawRect(m_rectResize.adjusted(-1, -1, -1, -1));
if (m_eMode == mResize) if (m_eMode == mResize)
{ {
// draw the resize diagonal lines // draw the resize diagonal lines
painter->drawLine(0, 0, qRound(m_rectBoundingBox.width()), qRound(m_rectBoundingBox.height())); painter->drawLine(1, 1, qFloor(m_rectBoundingBox.width())-1, qFloor(m_rectBoundingBox.height())-1);
painter->drawLine(0, qRound(m_rectBoundingBox.height()), qRound(m_rectBoundingBox.width()), 0); painter->drawLine(1, qFloor(m_rectBoundingBox.height())-1, qFloor(m_rectBoundingBox.width())-1, 1);
} }
} }
else else
@ -161,9 +174,11 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->setBrush(Qt::black); painter->setBrush(Qt::black);
painter->drawEllipse( painter->drawEllipse(
QPointF(m_rectBoundingBox.width()/2, m_rectBoundingBox.height()/2), QPointF(m_rectBoundingBox.width()/2, m_rectBoundingBox.height()/2),
ROTATE_CIRCLE, rotateCircle,
ROTATE_CIRCLE rotateCircle
); );
if (m_rectBoundingBox.width() > minW*3 && m_rectBoundingBox.height() > minH*3)
{
painter->setPen(QPen(Qt::black, 3)); painter->setPen(QPen(Qt::black, 3));
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
// and then draw the arc in each of the corners // and then draw the arc in each of the corners
@ -178,6 +193,7 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
} }
} }
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -209,24 +225,6 @@ bool VTextGraphicsItem::IsIdle() const
void VTextGraphicsItem::AddLine(const TextLine& tl) void VTextGraphicsItem::AddLine(const TextLine& tl)
{ {
m_tm.AddSourceLine(tl); m_tm.AddSourceLine(tl);
/*
qreal fW = MIN_W;
qreal fH = m_iMinH;
qreal fMinW;
qreal fMinH;
while (m_tm.IsBigEnough(fW, fH, MIN_FONT_SIZE, fMinW, fMinH) == false)
{
SetSize(fMinW, fMinH);
fW = m_rectBoundingBox.width();
fH = m_rectBoundingBox.height();
}
qreal dX;
qreal dY;
if (IsContained(m_rectBoundingBox, rotation(), dX, dY) == false)
{
setPos(m_rectBoundingBox.left() + dX, m_rectBoundingBox.top() + dY);
}
*/
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -249,37 +247,32 @@ void VTextGraphicsItem::SetSize(qreal fW, qreal fH)
{ {
qDebug() << "Setting size to" << fW << parentItem()->boundingRect().width(); qDebug() << "Setting size to" << fW << parentItem()->boundingRect().width();
// don't allow resize under specific size // don't allow resize under specific size
if (fW < MIN_W || fH < m_iMinH)
{
return;
}
if (fW > parentItem()->boundingRect().width()) if (fW > parentItem()->boundingRect().width())
{ {
fW = parentItem()->boundingRect().width(); fW = parentItem()->boundingRect().width();
} }
if (fW < MIN_W) if (fW < minW)
{ {
fW = MIN_W; fW = minW;
} }
if (fH > parentItem()->boundingRect().height()) if (fH > parentItem()->boundingRect().height())
{ {
fH = parentItem()->boundingRect().height(); fH = parentItem()->boundingRect().height();
} }
if (fH < m_iMinH) if (fH < minH)
{ {
fH = m_iMinH; fH = minH;
} }
prepareGeometryChange();
qDebug() << "Actual size set to" << fW; qDebug() << "Actual size set to" << fW;
m_rectBoundingBox.setTopLeft(QPointF(0, 0)); m_rectBoundingBox.setTopLeft(QPointF(0, 0));
m_rectBoundingBox.setWidth(fW); m_rectBoundingBox.setWidth(fW);
m_rectBoundingBox.setHeight(fH); m_rectBoundingBox.setHeight(fH);
m_rectResize.setTopLeft(QPointF(fW - RESIZE_SQUARE, fH - RESIZE_SQUARE)); m_rectResize.setTopLeft(QPointF(fW - resizeSquare, fH - resizeSquare));
m_rectResize.setWidth(RESIZE_SQUARE); m_rectResize.setWidth(resizeSquare);
m_rectResize.setHeight(RESIZE_SQUARE); m_rectResize.setHeight(resizeSquare);
setTransformOriginPoint(m_rectBoundingBox.center()); setTransformOriginPoint(m_rectBoundingBox.center());
prepareGeometryChange();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -440,7 +433,7 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
qreal dX; qreal dX;
qreal dY; qreal dY;
QRectF rectBB; QRectF rectBB;
QPointF ptDiff = pME->scenePos() - m_ptStart; const QPointF ptDiff = pME->scenePos() - m_ptStart;
if (m_eMode == mMove) if (m_eMode == mMove)
{ {
// in move mode move the label along the mouse move from the origin // in move mode move the label along the mouse move from the origin
@ -465,13 +458,15 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
QSizeF sz(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y()); QSizeF sz(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y());
rectBB.setSize(sz); rectBB.setSize(sz);
// before resizing the label to a new size, check if it will still be inside the parent item // before resizing the label to a new size, check if it will still be inside the parent item
if (IsContained(rectBB, rotation(), dX, dY) == true) if (IsContained(rectBB, rotation(), dX, dY) == false)
{ {
sz = QSizeF(sz.width()+dX, sz.height()+dY);
}
SetSize(sz.width(), sz.height()); SetSize(sz.width(), sz.height());
Update(); Update();
emit SignalShrink(); emit SignalShrink();
} }
}
else if (m_eMode == mRotate) else if (m_eMode == mRotate)
{ {
// if the angle from the original position is small (0.5 degrees), just remeber the new angle // if the angle from the original position is small (0.5 degrees), just remeber the new angle

View File

@ -75,13 +75,14 @@ public:
virtual ~VTextGraphicsItem(); virtual ~VTextGraphicsItem();
void SetFont(const QFont& fnt); void SetFont(const QFont& fnt);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget) Q_DECL_OVERRIDE;
void Reset(); void Reset();
bool IsIdle() const; bool IsIdle() const;
int GetFontSize() const; int GetFontSize() const;
QRectF boundingRect() const; virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
void AddLine(const TextLine& tl); void AddLine(const TextLine& tl);
void Clear(); void Clear();
void SetSize(qreal fW, qreal fH); void SetSize(qreal fW, qreal fH);
@ -92,11 +93,11 @@ public:
int GetTextLines() const; int GetTextLines() const;
protected: protected:
void mousePressEvent(QGraphicsSceneMouseEvent* pME); virtual void mousePressEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
void mouseMoveEvent(QGraphicsSceneMouseEvent* pME); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QGraphicsSceneMouseEvent* pME); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
void hoverMoveEvent(QGraphicsSceneHoverEvent* pHE); virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* pHE) Q_DECL_OVERRIDE;
void hoverLeaveEvent(QGraphicsSceneHoverEvent* pHE); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* pHE) Q_DECL_OVERRIDE;
void UpdateBox(); void UpdateBox();
void CorrectLabel(); void CorrectLabel();
@ -118,7 +119,6 @@ private:
double m_dRotation; double m_dRotation;
double m_dAngle; double m_dAngle;
QRectF m_rectResize; QRectF m_rectResize;
int m_iMinH;
QRectF m_rectBoundingBox; QRectF m_rectBoundingBox;
VTextManager m_tm; VTextManager m_tm;

View File

@ -837,12 +837,10 @@ void VToolDetail::UpdateLabel()
if (data.IsVisible() == true) if (data.IsVisible() == true)
{ {
QFont fnt = qApp->font(); QFont fnt = qApp->font();
int iFS = data.GetFontSize();
if (iFS < MIN_FONT_SIZE)
{ {
iFS = MIN_FONT_SIZE; const int iFS = data.GetFontSize();
iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS);
} }
fnt.setPixelSize(iFS);
dataLabel->SetFont(fnt); dataLabel->SetFont(fnt);
dataLabel->SetSize(data.GetLabelWidth(), data.GetLabelHeight()); dataLabel->SetSize(data.GetLabelWidth(), data.GetLabelHeight());
dataLabel->UpdateData(detail.getName(), data); dataLabel->UpdateData(detail.getName(), data);