Prepated detail dialog for formula editing in case of grainline length and rotation

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-09-08 22:35:32 +02:00
parent 385eae034a
commit 2dc19732a0
6 changed files with 163 additions and 55 deletions

View file

@ -724,17 +724,10 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
ptPos.setX(GetParametrDouble(element, AttrMx, "0"));
ptPos.setY(GetParametrDouble(element, AttrMy, "0"));
detail.GetGrainlineGeometry().SetPos(ptPos);
qreal dLength = GetParametrDouble(element, AttrLength, "0");
detail.GetGrainlineGeometry().SetLength(dLength);
if (detail.GetGrainlineGeometry().IsVisible() == true)
{
qreal dRot = GetParametrDouble(element, VToolDetail::AttrRotation, "0");
detail.GetGrainlineGeometry().SetRotation(dRot);
}
else
{
detail.GetGrainlineGeometry().SetRotation(0);
}
QString qsLength = GetParametrString(element, AttrLength, "0");
detail.GetGrainlineGeometry().SetLength(qsLength);
QString qsRot = GetParametrString(element, VToolDetail::AttrRotation, "0");
detail.GetGrainlineGeometry().SetRotation(qsRot);
}
}
}

View file

@ -378,8 +378,8 @@
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="length" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="rotation" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="node" maxOccurs="unbounded">

View file

@ -33,7 +33,7 @@
//---------------------------------------------------------------------------------------------------------------------
VGrainlineGeometry::VGrainlineGeometry()
:m_ptPos(0, 0), m_dLength(0), m_dRotation(0), m_bVisible(true)
:m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(true)
{}
//---------------------------------------------------------------------------------------------------------------------
@ -57,30 +57,30 @@ void VGrainlineGeometry::SetPos(const QPointF &ptPos)
//---------------------------------------------------------------------------------------------------------------------
qreal VGrainlineGeometry::GetLength() const
QString VGrainlineGeometry::GetLength() const
{
return m_dLength;
return m_qsLength;
}
//---------------------------------------------------------------------------------------------------------------------
void VGrainlineGeometry::SetLength(qreal dLen)
void VGrainlineGeometry::SetLength(QString qsLen)
{
m_dLength = dLen;
m_qsLength = qsLen;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VGrainlineGeometry::GetRotation() const
QString VGrainlineGeometry::GetRotation() const
{
return m_dRotation;
return m_qsRotation;
}
//---------------------------------------------------------------------------------------------------------------------
void VGrainlineGeometry::SetRotation(qreal dRot)
void VGrainlineGeometry::SetRotation(QString qsRot)
{
m_dRotation = dRot;
m_qsRotation = qsRot;
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -30,6 +30,7 @@
#define VGRAINLINEGEOMETRY_H
#include <QtGlobal>
#include <QString>
class QPointF;
@ -46,10 +47,10 @@ public:
// methods, which set and return values of different parameters
QPointF GetPos() const;
void SetPos(const QPointF& ptPos);
qreal GetLength() const;
void SetLength(qreal dLen);
qreal GetRotation() const;
void SetRotation(qreal dRot);
QString GetLength() const;
void SetLength(QString qsLen);
QString GetRotation() const;
void SetRotation(QString qsRot);
bool IsVisible() const;
void SetVisible(bool bVisible);
@ -59,13 +60,13 @@ private:
*/
QPointF m_ptPos;
/**
* @brief m_dLength total length of grainline
* @brief m_dLength formula to calculate the length of grainline
*/
qreal m_dLength;
QString m_qsLength;
/**
* @brief m_dRotation rotation of grainline in [degrees]
* @brief m_dRotation formula to calculate the rotation of grainline in [degrees]
*/
qreal m_dRotation;
QString m_qsRotation;
/**
* @brief m_bVisible visibility flag
*/

View file

@ -469,7 +469,8 @@ VDetail DialogDetail::CreateDetail() const
detail.GetGrainlineGeometry().SetVisible(ui.checkBoxGrainline->isChecked());
if (ui.checkBoxGrainline->isChecked() == true)
{
detail.GetGrainlineGeometry().SetRotation(ui.spinBoxGrainlineRotation->value());
detail.GetGrainlineGeometry().SetRotation(ui.lineEditRotFormula->text());
detail.GetGrainlineGeometry().SetLength(ui.lineEditLenFormula->text());
}
return detail;
}
@ -542,7 +543,8 @@ void DialogDetail::setDetail(const VDetail &value)
UpdateList();
ui.checkBoxGrainline->setChecked(detail.GetGrainlineGeometry().IsVisible());
ui.spinBoxGrainlineRotation->setValue(detail.GetGrainlineGeometry().GetRotation());
ui.lineEditRotFormula->setText(detail.GetGrainlineGeometry().GetRotation());
ui.lineEditLenFormula->setText(detail.GetGrainlineGeometry().GetLength());
m_oldData = detail.GetPatternPieceData();
m_oldGeom = detail.GetPatternInfo();
@ -865,5 +867,10 @@ void DialogDetail::SetEditMode()
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::EnableGrainlineRotation()
{
ui.spinBoxGrainlineRotation->setEnabled(ui.checkBoxGrainline->isChecked());
ui.lineEditRotValue->setEnabled(ui.checkBoxGrainline->isChecked());
ui.lineEditRotFormula->setEnabled(ui.checkBoxGrainline->isChecked());
ui.lineEditLenValue->setEnabled(ui.checkBoxGrainline->isChecked());
ui.lineEditLenFormula->setEnabled(ui.checkBoxGrainline->isChecked());
ui.pushButtonRot->setEnabled(ui.checkBoxGrainline->isChecked());
ui.pushButtonLen->setEnabled(ui.checkBoxGrainline->isChecked());
}

View file

@ -540,28 +540,11 @@
<rect>
<x>10</x>
<y>10</y>
<width>291</width>
<height>62</height>
<width>361</width>
<height>201</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Rotation:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxGrainlineRotation">
<property name="suffix">
<string>°</string>
</property>
<property name="maximum">
<number>359</number>
</property>
</widget>
</item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0" columnminimumwidth="0,0,30">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxGrainline">
<property name="text">
@ -569,6 +552,132 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Length</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelLen">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Value</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Value</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Rotation</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Formula</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelRot">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Formula</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonRot">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>f(x)</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonLen">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>f(x)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditRotValue">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditRotFormula">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditLenValue">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEditLenFormula">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -604,13 +713,11 @@
<tabstop>checkBoxSeams</tabstop>
<tabstop>doubleSpinBoxSeams</tabstop>
<tabstop>toolButtonDown</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>checkBoxForbidFlipping</tabstop>
<tabstop>checkBoxDetail</tabstop>
<tabstop>checkBoxPattern</tabstop>
<tabstop>lineEditLetter</tabstop>
<tabstop>checkBoxGrainline</tabstop>
<tabstop>spinBoxGrainlineRotation</tabstop>
</tabstops>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>