Added width/height/depth properties to element definitions

Adds three new elementInformation keys — width, height, depth (in mm)
— alongside the existing manufacturer/manufacturer_reference fields.
These describe the physical dimensions of the device a symbol
represents, set once per element definition.

Values are restricted to plain decimal numbers via a QDoubleValidator
on the information tree's item delegate (fixed-point, "." as decimal
separator via QLocale::c(), independent of the UI language), so a
later consumer can always parse them with toDouble() without
additional sanitization.
This commit is contained in:
Levi Jetzer
2026-08-11 16:09:34 +02:00
parent 3a3182862c
commit c23999acd1
3 changed files with 29 additions and 4 deletions
@@ -64,9 +64,22 @@ class EditorDelegate : public QItemDelegate
{
if(index.column() == 1)
{
return QItemDelegate::createEditor(parent,
option,
index);
const QString key = index.sibling(index.row(), 0)
.data(Qt::UserRole).toString();
if (key == QETInformation::ELMT_WIDTH ||
key == QETInformation::ELMT_HEIGHT ||
key == QETInformation::ELMT_DEPTH)
{
auto *line_edit = new QLineEdit(parent);
auto *validator = new QDoubleValidator(0.0, 100000.0, 4, line_edit);
validator->setNotation(QDoubleValidator::StandardNotation);
validator->setLocale(QLocale::c());
line_edit->setValidator(validator);
return line_edit;
}
return QItemDelegate::createEditor(parent, option, index);
}
return nullptr;
}