Fixed issue #253. Add description, id, size base and height base to Table of
Variables. --HG-- branch : develop
This commit is contained in:
parent
72324c0942
commit
326a790044
|
@ -100,6 +100,27 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
ui->toolBoxMeasurements->setItemEnabled(0, false);
|
||||
|
||||
const QString filePath = doc->MPath();
|
||||
VStandardMeasurements *mSt;
|
||||
try
|
||||
{
|
||||
VDomDocument::ValidateXML("://schema/standard_measurements.xsd", filePath);
|
||||
mSt = new VStandardMeasurements(data);
|
||||
mSt->setXMLContent(filePath);
|
||||
|
||||
ui->labelBaseValues->setText(tr("Base size: %1 %3; Base height: %2 %3").arg(mSt->Size())
|
||||
.arg(mSt->Height()).arg(VDomDocument::UnitsToStr(qApp->patternUnit())));
|
||||
ui->labelDescription->setText(tr("Description: \"%1\"").arg(mSt->TrDescription()));
|
||||
delete mSt;
|
||||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("File error."), this);
|
||||
delete mSt;
|
||||
emit DialogClosed(QDialog::Rejected);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -133,6 +154,10 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
connect(ui->comboBoxSex, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogIncrements::SaveSex);
|
||||
connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &DialogIncrements::SaveBirthDate);
|
||||
|
||||
// hide fileds that don't exist in individual measurements
|
||||
ui->labelBaseValues->setVisible(false);
|
||||
ui->labelDescription->setVisible(false);
|
||||
}
|
||||
|
||||
ui->toolBoxMeasurements->setCurrentIndex(1);
|
||||
|
|
|
@ -118,8 +118,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>559</width>
|
||||
<height>82</height>
|
||||
<width>939</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
|
@ -290,6 +290,23 @@
|
|||
<string>Measurements</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelBaseValues">
|
||||
<property name="text">
|
||||
<string notr="true">Base size: ; base height: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelDescription">
|
||||
<property name="text">
|
||||
<string notr="true">Description:</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxHideEmpty">
|
||||
<property name="text">
|
||||
|
|
|
@ -183,16 +183,11 @@ void DialogStandardMeasurements::LoadStandardTables()
|
|||
}
|
||||
else
|
||||
{
|
||||
const QString trDesc = qApp->STDescription(m.Id());
|
||||
if (trDesc.isEmpty() == false)
|
||||
const QString desc = m.TrDescription();
|
||||
if (desc.isEmpty() == false)
|
||||
{
|
||||
qCDebug(vStMeasur)<<"Adding user table from"<<fi.absoluteFilePath();
|
||||
ui->comboBoxTables->addItem(trDesc, QVariant(fi.absoluteFilePath()));
|
||||
}
|
||||
else if (m.Description().isEmpty() == false)
|
||||
{
|
||||
qCDebug(vStMeasur)<<"Adding table with id"<<m.Id()<<"from"<<fi.absoluteFilePath();
|
||||
ui->comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath()));
|
||||
qCDebug(vStMeasur)<<"Adding table from"<<fi.absoluteFilePath();
|
||||
ui->comboBoxTables->addItem(desc, QVariant(fi.absoluteFilePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ VStandardMeasurements::~VStandardMeasurements()
|
|||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VStandardMeasurements::Description()
|
||||
QString VStandardMeasurements::OrigDescription ()
|
||||
{
|
||||
const QString desc = UniqueTagText(TagDescription, "");
|
||||
if (desc.isEmpty())
|
||||
|
@ -61,6 +61,20 @@ QString VStandardMeasurements::Description()
|
|||
return desc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VStandardMeasurements::TrDescription()
|
||||
{
|
||||
const QString trDesc = qApp->STDescription(Id());
|
||||
if (trDesc.isEmpty() == false)
|
||||
{
|
||||
return trDesc;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OrigDescription ();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VStandardMeasurements::Id()
|
||||
{
|
||||
|
@ -72,6 +86,18 @@ QString VStandardMeasurements::Id()
|
|||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VStandardMeasurements::Size() const
|
||||
{
|
||||
return TakeParametr(TagSize, AttrBase, 50);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VStandardMeasurements::Height() const
|
||||
{
|
||||
return TakeParametr(TagHeight, AttrBase, 176);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const QString &tag)
|
||||
{
|
||||
|
@ -124,15 +150,13 @@ qreal VStandardMeasurements::TakeParametr(const QString &tag, const QString &att
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VStandardMeasurements::SetSize()
|
||||
{
|
||||
const qreal value = TakeParametr(TagSize, AttrBase, 50);
|
||||
data->SetSize(value);
|
||||
data->SetSize(Size());
|
||||
data->SetSizeName(size_M);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VStandardMeasurements::SetHeight()
|
||||
{
|
||||
const qreal value = TakeParametr(TagHeight, AttrBase, 176);
|
||||
data->SetHeight(value);
|
||||
data->SetHeight(Height());
|
||||
data->SetHeightName(height_M);
|
||||
}
|
||||
|
|
|
@ -44,8 +44,13 @@ class VStandardMeasurements:public VAbstractMeasurements
|
|||
public:
|
||||
VStandardMeasurements(VContainer *data);
|
||||
virtual ~VStandardMeasurements();
|
||||
QString Description();
|
||||
QString OrigDescription ();
|
||||
QString TrDescription ();
|
||||
QString Id();
|
||||
|
||||
qreal Size() const;
|
||||
qreal Height() const;
|
||||
|
||||
void SetSize();
|
||||
void SetHeight();
|
||||
static const QString TagMeasurement;
|
||||
|
|
Loading…
Reference in New Issue
Block a user