Fixed issue #249. Size Base and Height Base (Calculations Error and Display
Wish List). --HG-- branch : develop
This commit is contained in:
parent
924af81eae
commit
72324c0942
|
@ -861,12 +861,12 @@ void MainWindow::ToolBarOption()
|
||||||
const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes());
|
const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes());
|
||||||
|
|
||||||
gradationHeights = SetGradationList(tr("Height: "), listHeights);
|
gradationHeights = SetGradationList(tr("Height: "), listHeights);
|
||||||
SetDefaultHeight(static_cast<int>(GHeights::H176));
|
SetDefaultHeight(static_cast<int>(pattern->height()));
|
||||||
connect(gradationHeights, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
connect(gradationHeights, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||||
this, &MainWindow::ChangedHeight);
|
this, &MainWindow::ChangedHeight);
|
||||||
|
|
||||||
gradationSizes = SetGradationList(tr("Size: "), listSizes);
|
gradationSizes = SetGradationList(tr("Size: "), listSizes);
|
||||||
SetDefaultSize(static_cast<int>(GSizes::S50));
|
SetDefaultSize(static_cast<int>(pattern->size()));
|
||||||
connect(gradationSizes, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
connect(gradationSizes, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||||
this, &MainWindow::ChangedSize);
|
this, &MainWindow::ChangedSize);
|
||||||
|
|
||||||
|
@ -890,12 +890,13 @@ QComboBox *MainWindow::SetGradationList(const QString &label, const QStringList
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief SetDefaultHeight set base height in combobox.
|
||||||
|
* @param value [in] height value in pattern units.
|
||||||
|
*/
|
||||||
void MainWindow::SetDefaultHeight(int value)
|
void MainWindow::SetDefaultHeight(int value)
|
||||||
{
|
{
|
||||||
qreal val = VAbstractMeasurements::UnitConvertor(value, Unit::Cm, qApp->patternUnit());
|
const qint32 index = gradationHeights->findText(QString("%1").arg(value));
|
||||||
QString strVal = QString("%1").arg(val);
|
|
||||||
|
|
||||||
qint32 index = gradationHeights->findText(strVal);
|
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
gradationHeights->setCurrentIndex(index);
|
gradationHeights->setCurrentIndex(index);
|
||||||
|
@ -907,12 +908,13 @@ void MainWindow::SetDefaultHeight(int value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief SetDefaultSize set base size in combobox.
|
||||||
|
* @param value [in] size value in pattern units.
|
||||||
|
*/
|
||||||
void MainWindow::SetDefaultSize(int value)
|
void MainWindow::SetDefaultSize(int value)
|
||||||
{
|
{
|
||||||
qreal val = VAbstractMeasurements::UnitConvertor(value, Unit::Cm, qApp->patternUnit());
|
const qint32 index = gradationSizes->findText(QString("%1").arg(value));
|
||||||
QString strVal = QString("%1").arg(val);
|
|
||||||
|
|
||||||
qint32 index = gradationSizes->findText(strVal);
|
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
gradationSizes->setCurrentIndex(index);
|
gradationSizes->setCurrentIndex(index);
|
||||||
|
|
|
@ -34,8 +34,10 @@ const QString VStandardMeasurements::TagDescription = QStringLiteral("descr
|
||||||
const QString VStandardMeasurements::TagId = QStringLiteral("id");
|
const QString VStandardMeasurements::TagId = QStringLiteral("id");
|
||||||
const QString VStandardMeasurements::TagSize = QStringLiteral("size");
|
const QString VStandardMeasurements::TagSize = QStringLiteral("size");
|
||||||
const QString VStandardMeasurements::TagHeight = QStringLiteral("height");
|
const QString VStandardMeasurements::TagHeight = QStringLiteral("height");
|
||||||
|
|
||||||
const QString VStandardMeasurements::AttrSize_increase = QStringLiteral("size_increase");
|
const QString VStandardMeasurements::AttrSize_increase = QStringLiteral("size_increase");
|
||||||
const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase");
|
const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase");
|
||||||
|
const QString VStandardMeasurements::AttrBase = QStringLiteral("base");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VStandardMeasurements::VStandardMeasurements(VContainer *data)
|
VStandardMeasurements::VStandardMeasurements(VContainer *data)
|
||||||
|
@ -93,7 +95,7 @@ void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) const
|
qreal VStandardMeasurements::TakeParametr(const QString &tag, const QString &attr, qreal defValue) const
|
||||||
{
|
{
|
||||||
const qreal defVal = UnitConvertor(defValue, Unit::Cm, qApp->patternUnit());
|
const qreal defVal = UnitConvertor(defValue, Unit::Cm, qApp->patternUnit());
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) co
|
||||||
const QDomElement domElement = domNode.toElement();
|
const QDomElement domElement = domNode.toElement();
|
||||||
if (domElement.isNull() == false)
|
if (domElement.isNull() == false)
|
||||||
{
|
{
|
||||||
qreal value = GetParametrDouble(domElement, AttrValue, QString("%1").arg(defVal));
|
qreal value = GetParametrDouble(domElement, attr, QString("%1").arg(defVal));
|
||||||
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
|
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +124,7 @@ qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) co
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VStandardMeasurements::SetSize()
|
void VStandardMeasurements::SetSize()
|
||||||
{
|
{
|
||||||
const qreal value = TakeParametr(TagSize, 50);
|
const qreal value = TakeParametr(TagSize, AttrBase, 50);
|
||||||
data->SetSize(value);
|
data->SetSize(value);
|
||||||
data->SetSizeName(size_M);
|
data->SetSizeName(size_M);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +132,7 @@ void VStandardMeasurements::SetSize()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VStandardMeasurements::SetHeight()
|
void VStandardMeasurements::SetHeight()
|
||||||
{
|
{
|
||||||
const qreal value = TakeParametr(TagHeight, 176);
|
const qreal value = TakeParametr(TagHeight, AttrBase, 176);
|
||||||
data->SetHeight(value);
|
data->SetHeight(value);
|
||||||
data->SetHeightName(height_M);
|
data->SetHeightName(height_M);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,13 +53,15 @@ public:
|
||||||
static const QString TagId;
|
static const QString TagId;
|
||||||
static const QString TagSize;
|
static const QString TagSize;
|
||||||
static const QString TagHeight;
|
static const QString TagHeight;
|
||||||
|
|
||||||
static const QString AttrSize_increase;
|
static const QString AttrSize_increase;
|
||||||
static const QString AttrHeight_increase;
|
static const QString AttrHeight_increase;
|
||||||
|
static const QString AttrBase;
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag);
|
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VStandardMeasurements)
|
Q_DISABLE_COPY(VStandardMeasurements)
|
||||||
qreal TakeParametr(const QString &tag, qreal defValue) const;
|
qreal TakeParametr(const QString &tag, const QString &attr, qreal defValue) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VSTANDARDMEASUREMENTS_H
|
#endif // VSTANDARDMEASUREMENTS_H
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
<xs:element name="height">
|
<xs:element name="height">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute name="base" type="xs:double"></xs:attribute>
|
<xs:attribute name="base" type="xs:double"></xs:attribute>
|
||||||
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="body-measurements">
|
<xs:element name="body-measurements">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user