3 #include <QDoubleValidator>
6 : _widget(new QWidget()), ui(new
Ui::FirstDerivariveForm), _dT(0.0)
9 ui->lineEditCustom->setValidator(
10 new QDoubleValidator(0.0001, 1000, 4,
ui->lineEditCustom));
12 connect(
ui->buttonCompute, &QPushButton::clicked,
this,
15 connect(
ui->lineEditCustom, &QLineEdit::editingFinished,
this, [=]() {
16 _dT = ui->lineEditCustom->text().toDouble();
17 emit parametersChanged();
20 connect(
ui->radioActual, &QRadioButton::toggled,
this, [=](
bool toggled) {
24 emit parametersChanged();
28 connect(ui->radioCustom, &QRadioButton::toggled,
this, [=](
bool toggled) {
31 _dT = ui->lineEditCustom->text().toDouble();
32 emit parametersChanged();
53 double dt = (
_dT == 0.0) ? (p.x - prev.x) :
_dT;
60 double der = (p.y - prev.y) / dt;
78 QDomElement widget_el = doc.createElement(
"options");
80 if (
ui->radioActual->isChecked())
82 widget_el.setAttribute(
"radioChecked",
"radioActual");
86 widget_el.setAttribute(
"radioChecked",
"radioCustom");
88 widget_el.setAttribute(
"lineEdit",
ui->lineEditCustom->text());
90 parent_element.appendChild(widget_el);
96 QDomElement widget_el = parent_element.firstChildElement(
"options");
97 if (widget_el.isNull())
102 ui->lineEditCustom->setText(widget_el.attribute(
"lineEdit"));
104 if (widget_el.attribute(
"radioChecked") ==
"radioActual")
106 ui->radioActual->setChecked(
true);
110 ui->radioCustom->setChecked(
true);
125 std::vector<double> diff;
126 diff.reserve(data_size - 1);
128 for (
size_t i = 1; i < data_size; i++)
131 double delta = t - prev_t;
133 diff.push_back(delta);
137 size_t last = diff.size();
142 last = (last * 4) / 5;
145 for (
size_t i =
first; i < last; i++)
149 double estimated_dt = total /
static_cast<double>(last -
first);
150 ui->lineEditCustom->setText(QString::number(estimated_dt,
'g', 4));
152 if (
ui->radioCustom->isChecked())