Added possibility to hide both labels for each detail individually
--HG-- branch : feature
This commit is contained in:
parent
aa1d1f8ce1
commit
192c4d33a7
|
@ -658,6 +658,8 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
}
|
}
|
||||||
else if (element.tagName() == TagData)
|
else if (element.tagName() == TagData)
|
||||||
{
|
{
|
||||||
|
QString qsVisible = element.attribute(AttrVisible, "1");
|
||||||
|
detail.GetPatternPieceData().SetVisible(qsVisible.toInt() != 0);
|
||||||
QString qsLetter = element.attribute(AttrLetter, "");
|
QString qsLetter = element.attribute(AttrLetter, "");
|
||||||
detail.GetPatternPieceData().SetLetter(qsLetter);
|
detail.GetPatternPieceData().SetLetter(qsLetter);
|
||||||
QPointF ptPos;
|
QPointF ptPos;
|
||||||
|
@ -687,6 +689,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
}
|
}
|
||||||
else if (element.tagName() == TagPatternInfo)
|
else if (element.tagName() == TagPatternInfo)
|
||||||
{
|
{
|
||||||
|
detail.GetPatternInfo().SetVisible(element.attribute(AttrVisible, "1").toInt() != 0);
|
||||||
QPointF ptPos;
|
QPointF ptPos;
|
||||||
ptPos.setX(element.attribute(AttrMx, "0").toDouble());
|
ptPos.setX(element.attribute(AttrMx, "0").toDouble());
|
||||||
ptPos.setY(element.attribute(AttrMy, "0").toDouble());
|
ptPos.setY(element.attribute(AttrMy, "0").toDouble());
|
||||||
|
|
|
@ -351,6 +351,7 @@
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
<xs:attribute name="letter" type="xs:string"></xs:attribute>
|
<xs:attribute name="letter" type="xs:string"></xs:attribute>
|
||||||
|
<xs:attribute name="visible" type="xs:unsignedInt"></xs:attribute>
|
||||||
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
||||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||||
|
@ -361,6 +362,7 @@
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
|
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
|
<xs:attribute name="visible" type="xs:unsignedInt"></xs:attribute>
|
||||||
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
||||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||||
|
|
|
@ -29,8 +29,9 @@
|
||||||
#include "vpatterninfogeometry.h"
|
#include "vpatterninfogeometry.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternInfoGeometry::VPatternInfoGeometry() :
|
VPatternInfoGeometry::VPatternInfoGeometry()
|
||||||
m_ptPos(0, 0)
|
:m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(MIN_FONT_SIZE),
|
||||||
|
m_dRotation(0), m_bVisible(true)
|
||||||
{
|
{
|
||||||
m_iFontSize = MIN_FONT_SIZE;
|
m_iFontSize = MIN_FONT_SIZE;
|
||||||
// 0 means unknown width
|
// 0 means unknown width
|
||||||
|
@ -106,3 +107,16 @@ void VPatternInfoGeometry::SetRotation(qreal dRot)
|
||||||
m_dRotation = dRot;
|
m_dRotation = dRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VPatternInfoGeometry::IsVisible() const
|
||||||
|
{
|
||||||
|
return m_bVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternInfoGeometry::SetVisible(bool bVal)
|
||||||
|
{
|
||||||
|
m_bVisible = bVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -50,6 +50,8 @@ public:
|
||||||
void SetFontSize(int iSize);
|
void SetFontSize(int iSize);
|
||||||
qreal GetRotation() const;
|
qreal GetRotation() const;
|
||||||
void SetRotation(qreal dRot);
|
void SetRotation(qreal dRot);
|
||||||
|
bool IsVisible() const;
|
||||||
|
void SetVisible(bool bVal);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointF m_ptPos;
|
QPointF m_ptPos;
|
||||||
|
@ -65,6 +67,10 @@ private:
|
||||||
/** @brief Label rotation
|
/** @brief Label rotation
|
||||||
*/
|
*/
|
||||||
qreal m_dRotation;
|
qreal m_dRotation;
|
||||||
|
/** @brief Visibility flag
|
||||||
|
*/
|
||||||
|
bool m_bVisible;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPATTERNINFOGEOMETRY_H
|
#endif // VPATTERNINFOGEOMETRY_H
|
||||||
|
|
|
@ -36,7 +36,7 @@ MaterialCutPlacement::MaterialCutPlacement()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternPieceData::VPatternPieceData()
|
VPatternPieceData::VPatternPieceData()
|
||||||
:m_qsLetter(), m_conMCP(), m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0),
|
:m_qsLetter(), m_conMCP(), m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0),
|
||||||
m_iFontSize(MIN_FONT_SIZE), m_dRotation(0)
|
m_iFontSize(MIN_FONT_SIZE), m_dRotation(0), m_bVisible(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -170,4 +170,16 @@ void VPatternPieceData::SetRotation(qreal dRot)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VPatternPieceData::IsVisible() const
|
||||||
|
{
|
||||||
|
return m_bVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternPieceData::SetVisible(bool bVal)
|
||||||
|
{
|
||||||
|
m_bVisible = bVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ public:
|
||||||
void SetFontSize(int iSize);
|
void SetFontSize(int iSize);
|
||||||
qreal GetRotation() const;
|
qreal GetRotation() const;
|
||||||
void SetRotation(qreal dRot);
|
void SetRotation(qreal dRot);
|
||||||
|
bool IsVisible() const;
|
||||||
|
void SetVisible(bool bVal);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** @brief Pattern piece letter (should be no more than 3 letters)
|
/** @brief Pattern piece letter (should be no more than 3 letters)
|
||||||
|
@ -118,6 +120,10 @@ private:
|
||||||
/** @brief Label rotation
|
/** @brief Label rotation
|
||||||
*/
|
*/
|
||||||
qreal m_dRotation;
|
qreal m_dRotation;
|
||||||
|
/** @brief Visibility flag
|
||||||
|
*/
|
||||||
|
bool m_bVisible;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPATTERNPIECEDATA_H
|
#endif // VPATTERNPIECEDATA_H
|
||||||
|
|
|
@ -372,8 +372,12 @@ VDetail DialogDetail::CreateDetail() const
|
||||||
detail.GetPatternPieceData().SetLabelHeight(m_oldData.GetLabelHeight());
|
detail.GetPatternPieceData().SetLabelHeight(m_oldData.GetLabelHeight());
|
||||||
detail.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize());
|
detail.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize());
|
||||||
detail.GetPatternPieceData().SetRotation(m_oldData.GetRotation());
|
detail.GetPatternPieceData().SetRotation(m_oldData.GetRotation());
|
||||||
|
detail.GetPatternPieceData().SetVisible(ui.checkBoxDetail->isChecked());
|
||||||
|
|
||||||
|
qDebug() << "DD VISIBLE" << detail.GetPatternPieceData().IsVisible();
|
||||||
|
|
||||||
detail.GetPatternInfo() = m_oldGeom;
|
detail.GetPatternInfo() = m_oldGeom;
|
||||||
|
detail.GetPatternInfo().SetVisible(ui.checkBoxPattern->isChecked());
|
||||||
|
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
@ -433,6 +437,8 @@ void DialogDetail::setDetail(const VDetail &value)
|
||||||
ui.toolButtonDelete->setEnabled(true);
|
ui.toolButtonDelete->setEnabled(true);
|
||||||
|
|
||||||
ui.lineEditLetter->setText(detail.GetPatternPieceData().GetLetter());
|
ui.lineEditLetter->setText(detail.GetPatternPieceData().GetLetter());
|
||||||
|
ui.checkBoxDetail->setChecked(detail.GetPatternPieceData().IsVisible());
|
||||||
|
ui.checkBoxPattern->setChecked(detail.GetPatternInfo().IsVisible());
|
||||||
|
|
||||||
m_conMCP.clear();
|
m_conMCP.clear();
|
||||||
for (int i = 0; i < detail.GetPatternPieceData().GetMCPCount(); ++i)
|
for (int i = 0; i < detail.GetPatternPieceData().GetMCPCount(); ++i)
|
||||||
|
|
|
@ -529,6 +529,32 @@
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="checkBoxDetail">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>230</y>
|
||||||
|
<width>141</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Detail label visible</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="checkBoxPattern">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>260</y>
|
||||||
|
<width>141</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pattern label visible</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -353,6 +353,7 @@ void VToolDetail::AddToFile()
|
||||||
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
||||||
const VPatternPieceData& data = detail.GetPatternPieceData();
|
const VPatternPieceData& data = detail.GetPatternPieceData();
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
||||||
|
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? 1:0);
|
||||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
||||||
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
||||||
|
@ -374,6 +375,7 @@ void VToolDetail::AddToFile()
|
||||||
|
|
||||||
domData = doc->createElement(VAbstractPattern::TagPatternInfo);
|
domData = doc->createElement(VAbstractPattern::TagPatternInfo);
|
||||||
const VPatternInfoGeometry& geom = detail.GetPatternInfo();
|
const VPatternInfoGeometry& geom = detail.GetPatternInfo();
|
||||||
|
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true? 1:0);
|
||||||
doc->SetAttribute(domData, AttrMx, geom.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, geom.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, geom.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, geom.GetPos().y());
|
||||||
doc->SetAttribute(domData, AttrWidth, geom.GetLabelWidth());
|
doc->SetAttribute(domData, AttrWidth, geom.GetLabelWidth());
|
||||||
|
@ -409,6 +411,8 @@ void VToolDetail::RefreshDataInFile()
|
||||||
|
|
||||||
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
||||||
const VPatternPieceData& data = det.GetPatternPieceData();
|
const VPatternPieceData& data = det.GetPatternPieceData();
|
||||||
|
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
||||||
|
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? 1:0);
|
||||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
||||||
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
||||||
|
@ -430,6 +434,7 @@ void VToolDetail::RefreshDataInFile()
|
||||||
|
|
||||||
domData = doc->createElement(VAbstractPattern::TagPatternInfo);
|
domData = doc->createElement(VAbstractPattern::TagPatternInfo);
|
||||||
const VPatternInfoGeometry& geom = det.GetPatternInfo();
|
const VPatternInfoGeometry& geom = det.GetPatternInfo();
|
||||||
|
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true? 1:0);
|
||||||
doc->SetAttribute(domData, AttrMx, geom.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, geom.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, geom.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, geom.GetPos().y());
|
||||||
doc->SetAttribute(domData, AttrWidth, geom.GetLabelWidth());
|
doc->SetAttribute(domData, AttrWidth, geom.GetLabelWidth());
|
||||||
|
@ -669,9 +674,9 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
void VToolDetail::UpdateLabel()
|
void VToolDetail::UpdateLabel()
|
||||||
{
|
{
|
||||||
const VDetail detail = VAbstractTool::data.GetDetail(id);
|
const VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
|
|
||||||
const VPatternPieceData& data = detail.GetPatternPieceData();
|
const VPatternPieceData& data = detail.GetPatternPieceData();
|
||||||
if (data.GetLetter().isEmpty() == false || detail.getName().isEmpty() == false || data.GetMCPCount() > 0)
|
|
||||||
|
if (data.IsVisible() == true)
|
||||||
{
|
{
|
||||||
//dataLabel->Reset();
|
//dataLabel->Reset();
|
||||||
|
|
||||||
|
@ -736,7 +741,8 @@ void VToolDetail::UpdatePatternInfo()
|
||||||
const VDetail detail = VAbstractTool::data.GetDetail(id);
|
const VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
const VPatternInfoGeometry& geom = detail.GetPatternInfo();
|
const VPatternInfoGeometry& geom = detail.GetPatternInfo();
|
||||||
|
|
||||||
//patternInfo->Reset();
|
if (geom.IsVisible() == true)
|
||||||
|
{
|
||||||
QFont fnt = qApp->font();
|
QFont fnt = qApp->font();
|
||||||
int iFS = geom.GetFontSize();
|
int iFS = geom.GetFontSize();
|
||||||
if (iFS < MIN_FONT_SIZE)
|
if (iFS < MIN_FONT_SIZE)
|
||||||
|
@ -792,6 +798,12 @@ void VToolDetail::UpdatePatternInfo()
|
||||||
patternInfo->setPos(pt);
|
patternInfo->setPos(pt);
|
||||||
patternInfo->setRotation(geom.GetRotation());
|
patternInfo->setRotation(geom.GetRotation());
|
||||||
patternInfo->Update();
|
patternInfo->Update();
|
||||||
|
patternInfo->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patternInfo->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -139,6 +139,7 @@ void SaveDetailOptions::SavePatternPieceData(QDomElement &domElement, const VDet
|
||||||
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
||||||
const VPatternPieceData& data = det.GetPatternPieceData();
|
const VPatternPieceData& data = det.GetPatternPieceData();
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
||||||
|
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? 1:0);
|
||||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
||||||
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
|
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
|
||||||
|
@ -164,6 +165,7 @@ void SaveDetailOptions::SavePatternInfo(QDomElement &domElement, const VDetail &
|
||||||
{
|
{
|
||||||
QDomElement domData = doc->createElement(VAbstractPattern::TagPatternInfo);
|
QDomElement domData = doc->createElement(VAbstractPattern::TagPatternInfo);
|
||||||
const VPatternInfoGeometry& data = det.GetPatternInfo();
|
const VPatternInfoGeometry& data = det.GetPatternInfo();
|
||||||
|
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? 1:0);
|
||||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
||||||
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
|
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user