diff --git a/src/app/share/collection/TestDart.val b/src/app/share/collection/TestDart.val index 1dd6bee39..bc3d1d8c4 100644 --- a/src/app/share/collection/TestDart.val +++ b/src/app/share/collection/TestDart.val @@ -1,7 +1,7 @@ - 0.3.2 + 0.2.4 cm diff --git a/src/libs/vpatterndb/vpatterninfogeometry.cpp b/src/libs/vpatterndb/vpatterninfogeometry.cpp index 11881bdbd..6de2bcc5d 100644 --- a/src/libs/vpatterndb/vpatterninfogeometry.cpp +++ b/src/libs/vpatterndb/vpatterninfogeometry.cpp @@ -90,9 +90,13 @@ int VPatternInfoGeometry::GetFontSize() const void VPatternInfoGeometry::SetFontSize(int iSize) { if (iSize >= MIN_FONT_SIZE) + { m_iFontSize = iSize; + } else + { m_iFontSize = MIN_FONT_SIZE; + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vpatterndb/vpatternpiecedata.cpp b/src/libs/vpatterndb/vpatternpiecedata.cpp index 20b694bb0..08beb8e54 100644 --- a/src/libs/vpatterndb/vpatternpiecedata.cpp +++ b/src/libs/vpatterndb/vpatternpiecedata.cpp @@ -152,9 +152,13 @@ int VPatternPieceData::GetFontSize() const void VPatternPieceData::SetFontSize(int iSize) { if (iSize >= MIN_FONT_SIZE) + { m_iFontSize = iSize; + } else + { m_iFontSize = MIN_FONT_SIZE; + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/vtextgraphicsitem.cpp b/src/libs/vtools/tools/vtextgraphicsitem.cpp index 71725959b..3b98e8f80 100644 --- a/src/libs/vtools/tools/vtextgraphicsitem.cpp +++ b/src/libs/vtools/tools/vtextgraphicsitem.cpp @@ -175,7 +175,9 @@ void VTextGraphicsItem::SetSize(qreal fW, qreal fH) { // don't allow resize under specific size if (fW < MIN_W || fH < m_iMinH) + { return; + } m_rectBoundingBox.setTopLeft(QPointF(0, 0)); m_rectBoundingBox.setWidth(fW); @@ -293,16 +295,14 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME) { QPointF pt = m_ptStartPos; rectBB.setTopLeft(pt); - QSize 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); - if (IsContained(rectBB, rotation(), dX, dY) == false) { - sz.setWidth(sz.width() + dX); - sz.setHeight(sz.height() + dY); + if (IsContained(rectBB, rotation(), dX, dY) == true) + { + SetSize(sz.width(), sz.height()); + Update(); + emit SignalShrink(); } - - SetSize(sz.width(), sz.height()); - Update(); - emit SignalShrink(); } else if (m_eMode == mRotate) { @@ -429,7 +429,7 @@ bool VTextGraphicsItem::IsBigEnough(qreal fW, qreal fH, int iFontSize) //--------------------------------------------------------------------------------------------------------------------- QStringList VTextGraphicsItem::SplitString(const QString &qs, qreal fW, const QFontMetrics &fm) { - QRegExp reg("\\s+"); + QRegularExpression reg("\\s+"); QStringList qslWords = qs.split(reg); QStringList qslLines; QString qsCurrent; @@ -437,7 +437,7 @@ QStringList VTextGraphicsItem::SplitString(const QString &qs, qreal fW, const QF { if (qsCurrent.length() > 0) { - qsCurrent += " "; + qsCurrent += QLatin1Literal(" "); } if (fm.width(qsCurrent + qslWords[i]) > fW) { @@ -460,9 +460,13 @@ double VTextGraphicsItem::GetAngle(QPointF pt) const double dY = pt.y() - m_ptRotCenter.y(); if (fabs(dX) < 1 && fabs(dY) < 1) + { return 0; + } else + { return atan2(dY, dX); + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/vtextgraphicsitem.h b/src/libs/vtools/tools/vtextgraphicsitem.h index 647427f61..ba218355c 100644 --- a/src/libs/vtools/tools/vtextgraphicsitem.h +++ b/src/libs/vtools/tools/vtextgraphicsitem.h @@ -85,7 +85,7 @@ protected: double GetAngle(QPointF pt) const; signals: - void SignalMoved(QPointF ptPos); + void SignalMoved(const QPointF& ptPos); void SignalResized(qreal iTW, int iFontSize); void SignalRotated(qreal dAng); void SignalShrink(); diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 70622c56e..446e41a28 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -134,12 +134,10 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 connect(dataLabel, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMoveDetail); connect(dataLabel, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizeDetail); connect(dataLabel, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationDetail); - //connect(dataLabel, &VTextGraphicsItem::SignalShrink, this, &VToolDetail::UpdateAll); connect(patternInfo, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMovePattern); connect(patternInfo, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizePattern); connect(patternInfo, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationPattern); - //connect(patternInfo, &VTextGraphicsItem::SignalShrink, this, &VToolDetail::UpdateAll); connect(doc, &VAbstractPattern::patternChanged, this, &VToolDetail::UpdatePatternInfo); connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdateLabel); @@ -820,7 +818,7 @@ void VToolDetail::UpdatePatternInfo() /** * @brief SaveMoveDetail saves the move detail operation to the undo stack */ -void VToolDetail::SaveMoveDetail(QPointF ptPos) +void VToolDetail::SaveMoveDetail(const QPointF& ptPos) { VDetail oldDet = VAbstractTool::data.GetDetail(id); VDetail newDet = oldDet; @@ -879,7 +877,7 @@ void VToolDetail::SaveRotationDetail(qreal dRot) /** * @brief SaveMovePattern saves the pattern label position */ -void VToolDetail::SaveMovePattern(QPointF ptPos) +void VToolDetail::SaveMovePattern(const QPointF &ptPos) { VDetail oldDet = VAbstractTool::data.GetDetail(id); VDetail newDet = oldDet; diff --git a/src/libs/vtools/tools/vtooldetail.h b/src/libs/vtools/tools/vtooldetail.h index d7086d5c2..a91526e05 100644 --- a/src/libs/vtools/tools/vtooldetail.h +++ b/src/libs/vtools/tools/vtooldetail.h @@ -111,10 +111,10 @@ protected: protected slots: virtual void UpdateLabel(); virtual void UpdatePatternInfo(); - virtual void SaveMoveDetail(QPointF ptPos); + virtual void SaveMoveDetail(const QPointF &ptPos); virtual void SaveResizeDetail(qreal dLabelW, int iFontSize); virtual void SaveRotationDetail(qreal dRot); - virtual void SaveMovePattern(QPointF ptPos); + virtual void SaveMovePattern(const QPointF& ptPos); virtual void SaveResizePattern(qreal dLabelW, int iFontSize); virtual void SaveRotationPattern(qreal dRot);