mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 13:24:14 +02:00
Guard numeric elementInformation fields against "." and normalize decimal comma
- ElementInfoWidget::currentInfo() now skips a field whose validator hasn't accepted its text (e.g. a lone "." mid-typing), which previously stored and later parsed to 0. - New QETInformation::NumericInfoValidator rewrites "," to "." before validating, so 80,5 on a German/French keyboard no longer silently becomes 805. Used at both existing call sites. - Restored the header's #1/#2/#3 doc comment (was reflowed into a run-on paragraph by a previous edit).
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include <QSplitter>
|
||||
#include <QShortcut>
|
||||
#include <QMenu>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
/**
|
||||
@brief The EditorDelegate class
|
||||
@@ -69,8 +70,7 @@ class EditorDelegate : public QItemDelegate
|
||||
if (key == QETInformation::ELMT_WIDTH || key == QETInformation::ELMT_HEIGHT || key == QETInformation::ELMT_DEPTH)
|
||||
{
|
||||
auto *line_edit = new QLineEdit(parent);
|
||||
auto *validator = new QRegularExpressionValidator(
|
||||
QETInformation::numericInfoPattern(), line_edit);
|
||||
auto *validator = new QETInformation::NumericInfoValidator(line_edit);
|
||||
line_edit->setValidator(validator);
|
||||
line_edit->setPlaceholderText(tr("ex. 80.5"));
|
||||
line_edit->setToolTip(tr("Nombre décimal avec un point comme séparateur (ex. 80.5)"));
|
||||
|
||||
Reference in New Issue
Block a user