Show unit prefix in dialog with variables.

--HG--
branch : develop
This commit is contained in:
dismine 2014-10-24 13:13:24 +03:00
parent 469eb6f9b3
commit 3b58eb3afa
2 changed files with 31 additions and 0 deletions

View File

@ -71,6 +71,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
} }
} }
ShowUnits();
TextDelegate *textDelegate = new TextDelegate(nameRegExp, data, ui->tableWidgetIncrement); TextDelegate *textDelegate = new TextDelegate(nameRegExp, data, ui->tableWidgetIncrement);
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
@ -345,6 +347,33 @@ void DialogIncrements::SetItemViewOnly(QTableWidgetItem *item)
item->setFlags(flags); item->setFlags(flags);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowUnits()
{
ShowHeaderUnits(ui->tableWidgetIncrement, 2);// base value
ShowHeaderUnits(ui->tableWidgetIncrement, 3);// in sizes
ShowHeaderUnits(ui->tableWidgetIncrement, 4);// in heights
ShowHeaderUnits(ui->tableWidgetMeasurements, 2);// base value
ShowHeaderUnits(ui->tableWidgetMeasurements, 3);// in sizes
ShowHeaderUnits(ui->tableWidgetMeasurements, 4);// in heights
ShowHeaderUnits(ui->tableWidgetLines, 1);// lengths
ShowHeaderUnits(ui->tableWidgetSplines, 1);// lengths
ShowHeaderUnits(ui->tableWidgetArcs, 1);// lengths
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column)
{
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);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowMeasurements() void DialogIncrements::ShowMeasurements()
{ {

View File

@ -105,6 +105,8 @@ private:
const qreal &ksize, const qreal &kheight, const QString &description); const qreal &ksize, const qreal &kheight, const QString &description);
void HideColumns(QTableWidget *table); void HideColumns(QTableWidget *table);
void SetItemViewOnly(QTableWidgetItem *item); void SetItemViewOnly(QTableWidgetItem *item);
void ShowUnits();
void ShowHeaderUnits(QTableWidget *table, int column);
}; };
#endif // DIALOGINCREMENTS_H #endif // DIALOGINCREMENTS_H