3 #include <QDoubleValidator>
9 ui->lineEditCustom->setValidator(
new QDoubleValidator(0.0001, 1000, 4));
11 connect(
ui->buttonCompute, &QPushButton::clicked,
this,
14 connect(
ui->lineEditCustom, &QLineEdit::editingFinished,
this, [=]() {
15 _dT = ui->lineEditCustom->text().toDouble();
16 emit parametersChanged();
19 connect(
ui->radioActual, &QRadioButton::toggled,
this, [=](
bool toggled) {
23 emit parametersChanged();
27 connect(ui->radioCustom, &QRadioButton::toggled,
this, [=](
bool toggled) {
30 _dT = ui->lineEditCustom->text().toDouble();
31 emit parametersChanged();
52 double dt = (
_dT == 0.0) ? (p.x - prev.x) :
_dT;
59 double val = (p.y + prev.y) * dt / (2.0);
84 QDomElement widget_el = doc.createElement(
"options");
86 if (
ui->radioActual->isChecked())
88 widget_el.setAttribute(
"radioChecked",
"radioActual");
92 widget_el.setAttribute(
"radioChecked",
"radioCustom");
94 widget_el.setAttribute(
"lineEdit",
ui->lineEditCustom->text());
96 parent_element.appendChild(widget_el);
102 QDomElement widget_el = parent_element.firstChildElement(
"options");
103 if (widget_el.isNull())
107 ui->lineEditCustom->setText(widget_el.attribute(
"lineEdit"));
109 if (widget_el.attribute(
"radioChecked") ==
"radioActual")
111 ui->radioActual->setChecked(
true);
115 ui->radioCustom->setChecked(
true);
130 std::vector<double> diff;
131 diff.reserve(data_size - 1);
133 for (
size_t i = 1; i < data_size; i++)
136 double delta = t - prev_t;
138 diff.push_back(delta);
142 size_t last = diff.size();
147 last = (last * 4) / 5;
150 for (
size_t i =
first; i < last; i++)
154 double estimated_dt = total /
static_cast<double>(last -
first);
155 ui->lineEditCustom->setText(QString::number(estimated_dt,
'g', 4));
157 if (
ui->radioCustom->isChecked())