Merged
--HG-- branch : feature
This commit is contained in:
commit
c58717a803
|
@ -42,7 +42,7 @@
|
|||
#define MIN_W 120
|
||||
#define MIN_H 60
|
||||
#define MIN_FONT_SIZE 12
|
||||
#define MAX_FONT_SIZE 48
|
||||
#define MAX_FONT_SIZE 128
|
||||
#define SPACING 2
|
||||
#define TOP_Z 2
|
||||
|
||||
|
@ -50,8 +50,6 @@
|
|||
VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem* pParent)
|
||||
: QGraphicsObject(pParent)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
m_eMode = mNormal;
|
||||
m_bReleased = false;
|
||||
m_rectBoundingBox.setTopLeft(QPointF(0, 0));
|
||||
|
@ -172,12 +170,14 @@ void VTextGraphicsItem::SetSize(qreal fW, qreal fH)
|
|||
if (fW < MIN_W || fH < m_iMinH)
|
||||
return;
|
||||
|
||||
m_rectBoundingBox.setTopLeft(QPointF(0, 0));
|
||||
m_rectBoundingBox.setWidth(fW);
|
||||
m_rectBoundingBox.setHeight(fH);
|
||||
m_rectResize.setTopLeft(QPointF(fW - RESIZE_SQUARE, fH - RESIZE_SQUARE));
|
||||
m_rectResize.setWidth(RESIZE_SQUARE);
|
||||
m_rectResize.setHeight(RESIZE_SQUARE);
|
||||
setTransformOriginPoint(m_rectBoundingBox.center());
|
||||
prepareGeometryChange();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -134,15 +134,15 @@ 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(dataLabel, &VTextGraphicsItem::SignalShrink, this, &VToolDetail::UpdateAll);
|
||||
|
||||
patternInfo = new VTextGraphicsItem(this);
|
||||
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(patternInfo, &VTextGraphicsItem::SignalShrink, this, &VToolDetail::UpdateAll);
|
||||
|
||||
connect(doc, &VAbstractPattern::patternChanged, this, &VToolDetail::UpdatePatternInfo);
|
||||
connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdateLabel);
|
||||
connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdatePatternInfo);
|
||||
UpdateLabel();
|
||||
|
@ -712,7 +712,17 @@ void VToolDetail::UpdateLabel()
|
|||
dataLabel->AddLine(tl);
|
||||
}
|
||||
|
||||
dataLabel->setPos(data.GetPos());
|
||||
QPointF pt;
|
||||
// check if center is inside
|
||||
if (boundingRect().contains(data.GetPos() + QPointF(data.GetLabelWidth()/2, data.GetLabelHeight()/2)) == false)
|
||||
{
|
||||
pt = boundingRect().topLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
pt = data.GetPos();
|
||||
}
|
||||
dataLabel->setPos(pt);
|
||||
dataLabel->setRotation(data.GetRotation());
|
||||
dataLabel->Update();
|
||||
dataLabel->show();
|
||||
|
@ -775,7 +785,17 @@ void VToolDetail::UpdatePatternInfo()
|
|||
tl.m_qsText = qslDate.last();
|
||||
patternInfo->AddLine(tl);
|
||||
|
||||
patternInfo->setPos(geom.GetPos());
|
||||
// check if center is inside
|
||||
QPointF pt;
|
||||
if (boundingRect().contains(geom.GetPos() + QPointF(geom.GetLabelWidth()/2, geom.GetLabelHeight()/2)) == false)
|
||||
{
|
||||
pt = boundingRect().topLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
pt = geom.GetPos();
|
||||
}
|
||||
patternInfo->setPos(pt);
|
||||
patternInfo->setRotation(geom.GetRotation());
|
||||
patternInfo->Update();
|
||||
}
|
||||
|
|
|
@ -128,8 +128,8 @@ private:
|
|||
QString drawName;
|
||||
|
||||
VNoBrushScalePathItem *seamAllowance;
|
||||
VTextGraphicsItem* dataLabel;
|
||||
VTextGraphicsItem* patternInfo;
|
||||
VTextGraphicsItem *dataLabel;
|
||||
VTextGraphicsItem *patternInfo;
|
||||
|
||||
VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
|
||||
VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem * parent = nullptr);
|
||||
|
|
Loading…
Reference in New Issue
Block a user