Show lines angle in list of variables.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-05-30 13:58:27 +03:00
parent 5f977c640e
commit d6c90d1bcc
3 changed files with 64 additions and 15 deletions

View File

@ -94,6 +94,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
FillMeasurements();
FillIncrements();
FillLengthLines();
FillLengthLinesAngle();
FillLengthSplines();
FillLengthArcs();
@ -355,6 +356,12 @@ void DialogIncrements::FillLengthLines()
FillTable(data->DataLengthLines(), ui->tableWidgetLines);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillLengthLinesAngle()
{
FillTable(data->DataAngleLines(), ui->tableWidgetLinesAngle);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief FillLengthSplines fill data for table of splines lengths
@ -385,25 +392,27 @@ void DialogIncrements::SetItemViewOnly(QTableWidgetItem *item)
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowUnits()
{
ShowHeaderUnits(ui->tableWidgetIncrement, 2);// base value
ShowHeaderUnits(ui->tableWidgetIncrement, 3);// in sizes
ShowHeaderUnits(ui->tableWidgetIncrement, 4);// in heights
const QString unit = VDomDocument::UnitsToStr(qApp->patternUnit());
ShowHeaderUnits(ui->tableWidgetMeasurements, 2);// base value
ShowHeaderUnits(ui->tableWidgetMeasurements, 3);// in sizes
ShowHeaderUnits(ui->tableWidgetMeasurements, 4);// in heights
ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// base value
ShowHeaderUnits(ui->tableWidgetIncrement, 3, unit);// in sizes
ShowHeaderUnits(ui->tableWidgetIncrement, 4, unit);// in heights
ShowHeaderUnits(ui->tableWidgetLines, 1);// lengths
ShowHeaderUnits(ui->tableWidgetSplines, 1);// lengths
ShowHeaderUnits(ui->tableWidgetArcs, 1);// lengths
ShowHeaderUnits(ui->tableWidgetMeasurements, 2, unit);// base value
ShowHeaderUnits(ui->tableWidgetMeasurements, 3, unit);// in sizes
ShowHeaderUnits(ui->tableWidgetMeasurements, 4, unit);// in heights
ShowHeaderUnits(ui->tableWidgetLines, 1, unit);// lengths
ShowHeaderUnits(ui->tableWidgetSplines, 1, unit);// lengths
ShowHeaderUnits(ui->tableWidgetArcs, 1, unit);// lengths
ShowHeaderUnits(ui->tableWidgetLinesAngle, 1, "°");// lengths
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column)
void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QString &unit)
{
SCASSERT(table != nullptr);
const QString unit = VDomDocument::UnitsToStr(qApp->patternUnit());
const QString header = table->horizontalHeaderItem(column)->text();
const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit);
table->horizontalHeaderItem(column)->setText(unitHeader);

View File

@ -99,6 +99,7 @@ private:
template <typename T>
void FillTable(const QMap<QString, T> varTable, QTableWidget *table);
void FillLengthLines();
void FillLengthLinesAngle();
void FillLengthSplines();
void FillLengthArcs();
void AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base,
@ -106,7 +107,7 @@ private:
void HideColumns(QTableWidget *table);
void SetItemViewOnly(QTableWidgetItem *item);
void ShowUnits();
void ShowHeaderUnits(QTableWidget *table, int column);
void ShowHeaderUnits(QTableWidget *table, int column, const QString &unit);
void ShowSuccess() const;
};

View File

@ -39,7 +39,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="tabStandard">
<property name="sizePolicy">
@ -118,8 +118,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>939</width>
<height>411</height>
<width>559</width>
<height>82</height>
</rect>
</property>
<attribute name="icon">
@ -548,6 +548,45 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Lines angle</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QTableWidget" name="tableWidgetLinesAngle">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>137</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Line</string>
</property>
</column>
<column>
<property name="text">
<string>Angle</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Curves</string>