47 QDoubleValidator* validator =
new QDoubleValidator();
48 QLocale* locale =
new QLocale(QLocale::C);
49 locale->setNumberOptions(QLocale::RejectGroupSeparator);
50 validator->setLocale(*locale);
52 validator->setNotation(QDoubleValidator::StandardNotation);
58 validator->setBottom(0.0);
62 validator->setBottom(0.0001);
65 setValidator(validator);
77 if (evt->key() == Qt::Key_Comma)
79 evt =
new QKeyEvent(QEvent::KeyPress, Qt::Key_Period, Qt::NoModifier, 0, 0, 0,
".");
82 QLineEdit::keyPressEvent(evt);
87 if (!this->hasAcceptableInput())
89 this->setStyleSheet(
"QLineEdit { color: red;}");
93 this->setStyleSheet(
"QLineEdit { color: black;}");
98 QObject* parent = this->parent();
100 while (formDialog ==
nullptr && parent !=
nullptr)
102 parent = parent->parent();
106 if (formDialog !=
nullptr)
outil IHM pour une entrée utilisateur (fichier header)
TYLineEdit(const QString &contents, bool isZeroOK=true, bool canBeNegative=true, QWidget *parent=nullptr)
void keyPressEvent(QKeyEvent *evt)