mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-10 03:42:09 +08:00
Cabana: use QLineEdit for double value (#26247)
old-commit-hash: d549e1899dbc7f28e0f27db51d875b30caa12ab0
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "tools/cabana/signaledit.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDoubleValidator>
|
||||
#include <QFormLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
@@ -36,13 +37,16 @@ SignalForm::SignalForm(const Signal &sig, QWidget *parent) : QWidget(parent) {
|
||||
sign->setCurrentIndex(sig.is_signed ? 0 : 1);
|
||||
form_layout->addRow(tr("sign"), sign);
|
||||
|
||||
factor = new QDoubleSpinBox();
|
||||
factor->setDecimals(3);
|
||||
factor->setValue(sig.factor);
|
||||
auto double_validator = new QDoubleValidator(this);
|
||||
|
||||
factor = new QLineEdit();
|
||||
factor->setValidator(double_validator);
|
||||
factor->setText(QString::number(sig.factor));
|
||||
form_layout->addRow(tr("Factor"), factor);
|
||||
|
||||
offset = new QSpinBox();
|
||||
offset->setValue(sig.offset);
|
||||
offset = new QLineEdit();
|
||||
offset->setValidator(double_validator);
|
||||
offset->setText(QString::number(sig.offset));
|
||||
form_layout->addRow(tr("Offset"), offset);
|
||||
|
||||
// TODO: parse the following parameters in opendbc
|
||||
@@ -50,11 +54,11 @@ SignalForm::SignalForm(const Signal &sig, QWidget *parent) : QWidget(parent) {
|
||||
form_layout->addRow(tr("Unit"), unit);
|
||||
comment = new QLineEdit();
|
||||
form_layout->addRow(tr("Comment"), comment);
|
||||
min_val = new QDoubleSpinBox();
|
||||
factor->setDecimals(3);
|
||||
min_val = new QLineEdit();
|
||||
min_val->setValidator(double_validator);
|
||||
form_layout->addRow(tr("Minimum value"), min_val);
|
||||
max_val = new QDoubleSpinBox();
|
||||
factor->setDecimals(3);
|
||||
max_val = new QLineEdit();
|
||||
max_val->setValidator(double_validator);
|
||||
form_layout->addRow(tr("Maximum value"), max_val);
|
||||
val_desc = new QLineEdit();
|
||||
form_layout->addRow(tr("Value descriptions"), val_desc);
|
||||
|
||||
@@ -16,9 +16,8 @@ class SignalForm : public QWidget {
|
||||
public:
|
||||
SignalForm(const Signal &sig, QWidget *parent);
|
||||
|
||||
QLineEdit *name, *unit, *comment, *val_desc;
|
||||
QSpinBox *size, *offset;
|
||||
QDoubleSpinBox *factor, *min_val, *max_val;
|
||||
QLineEdit *name, *unit, *comment, *val_desc, *offset, *factor, *min_val, *max_val;
|
||||
QSpinBox *size;
|
||||
QComboBox *sign, *endianness;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user