Fixed few bugs: label position is preserved after editing detail, buttons for add/update/remove MCP are handled correcty. Added style to VTextGraphicsItem lines
--HG-- branch : feature
This commit is contained in:
parent
21debaf249
commit
e68fa3a0f3
|
@ -346,6 +346,8 @@ VDetail DialogDetail::CreateDetail() const
|
|||
detail.GetPatternPieceData().Append(m_conMCP[i]);
|
||||
}
|
||||
|
||||
detail.GetPatternPieceData().SetPos(m_ptPos);
|
||||
|
||||
return detail;
|
||||
}
|
||||
|
||||
|
@ -404,6 +406,7 @@ void DialogDetail::setDetail(const VDetail &value)
|
|||
}
|
||||
|
||||
UpdateList();
|
||||
m_ptPos = detail.GetPatternPieceData().GetPos();
|
||||
|
||||
ValidObjects(DetailIsValid());
|
||||
}
|
||||
|
@ -692,7 +695,7 @@ void DialogDetail::SetEditMode()
|
|||
{
|
||||
int iR = ui.listWidgetMCP->currentRow();
|
||||
// this method can be called by clicking on item or by update. In the latter case there is nothing else to do!
|
||||
if (iR < 0 || iR >= detail.GetPatternPieceData().GetMCPCount())
|
||||
if (iR < 0 || iR >= m_conMCP.count())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -701,7 +704,7 @@ void DialogDetail::SetEditMode()
|
|||
ui.pushButtonCancel->show();
|
||||
ui.pushButtonRemove->show();
|
||||
|
||||
MaterialCutPlacement mcp = detail.GetPatternPieceData().GetMCP(iR);
|
||||
MaterialCutPlacement mcp = m_conMCP.at(iR);
|
||||
ui.comboBoxMaterial->setCurrentText(mcp.m_qsMaterialUserDef);
|
||||
ui.spinBoxCutNumber->setValue(mcp.m_iCutNumber);
|
||||
ui.comboBoxPlacement->setCurrentIndex(int(mcp.m_ePlacement));
|
||||
|
|
|
@ -100,6 +100,7 @@ private:
|
|||
QStringList m_qslPlacements;
|
||||
// temporary container for Material/Cut/Placement 3-tuples
|
||||
MCPContainer m_conMCP;
|
||||
QPointF m_ptPos;
|
||||
|
||||
void ClearFields();
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||
iH = tl.m_iHeight;
|
||||
fnt.setPixelSize(m_font.pixelSize() + tl.m_iFontSize);
|
||||
fnt.setWeight(tl.m_eFontWeight);
|
||||
fnt.setStyle(tl.m_eStyle);
|
||||
painter->setFont(fnt);
|
||||
painter->drawText(0, iY, boundingRect().width(), iH, tl.m_eAlign, tl.m_qsText);
|
||||
iY += iH + SPACING;
|
||||
|
@ -186,6 +187,14 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
||||
{
|
||||
if (m_eMode == mMove)
|
||||
{
|
||||
emit SignalMoved(pos());
|
||||
}
|
||||
else
|
||||
{
|
||||
emit SignalResized(m_rectBoundingBox.width(), m_font.pixelSize());
|
||||
}
|
||||
m_eMode = mActivated;
|
||||
Update();
|
||||
}
|
||||
|
@ -229,9 +238,9 @@ bool VTextGraphicsItem::IsBigEnough(qreal fW, qreal fH, int iFontSize)
|
|||
QFontMetrics fm(fnt);
|
||||
tlOut.m_iHeight = fm.height();
|
||||
QStringList qslLines = SplitString(tlOut.m_qsText, fW, fm);
|
||||
for (int i = 0; i < qslLines.count(); ++i)
|
||||
for (int iL = 0; iL < qslLines.count(); ++iL)
|
||||
{
|
||||
tlOut.m_qsText = qslLines[i];
|
||||
tlOut.m_qsText = qslLines[iL];
|
||||
m_liOutput << tlOut;
|
||||
iY += tlOut.m_iHeight + SPACING;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ struct TextLine
|
|||
QString m_qsText;
|
||||
int m_iFontSize; // 0 means default
|
||||
QFont::Weight m_eFontWeight;
|
||||
QFont::Style m_eStyle;
|
||||
Qt::Alignment m_eAlign;
|
||||
int m_iHeight;
|
||||
};
|
||||
|
|
|
@ -311,6 +311,7 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
|
|||
VDetail newDet = dialogTool->getDetail();
|
||||
VDetail oldDet = VAbstractTool::data.GetDetail(id);
|
||||
|
||||
qDebug() << "VToolDetail Position" << newDet.GetPatternPieceData().GetPos();
|
||||
SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
|
||||
connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(saveCommand);
|
||||
|
@ -653,14 +654,14 @@ void VToolDetail::UpdateLabel()
|
|||
tl.m_qsText = data.GetLetter();
|
||||
tl.m_eAlign = Qt::AlignCenter;
|
||||
tl.m_eFontWeight = QFont::Bold;
|
||||
tl.m_iFontSize = 4;
|
||||
tl.m_eStyle = QFont::StyleNormal;
|
||||
tl.m_iFontSize = 6;
|
||||
dataLabel->AddLine(tl);
|
||||
tl.m_qsText = data.GetName();
|
||||
tl.m_eAlign = Qt::AlignCenter;
|
||||
tl.m_eFontWeight = QFont::DemiBold;
|
||||
tl.m_iFontSize = 2;
|
||||
dataLabel->AddLine(tl);
|
||||
|
||||
// MCP
|
||||
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
|
|
Loading…
Reference in New Issue
Block a user