6 #include <QDoubleSpinBox>
15 setSizePolicy(QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Minimum);
17 QLayout* vlayout =
new QVBoxLayout();
18 QLayout* hlayout =
new QHBoxLayout();
19 this->setLayout(vlayout);
22 hlayout->setContentsMargins(margin, margin, margin, margin);
24 _updateButton =
new QPushButton(
"Update",
this);
25 _autoCheckBox =
new QCheckBox(
"Auto Update",
this);
26 _frequencySpinBox =
new QDoubleSpinBox(
this);
27 _frequencySpinBox->setValue(frequency);
28 _frequencySpinBox->setMinimum(0);
29 _frequencySpinBox->setMaximum(maxFrequency);
30 _frequencySpinBox->setSingleStep(0.5);
31 _frequencySpinBox->setSuffix(
" Hz");
33 hlayout->addWidget(_updateButton);
34 hlayout->addWidget(_autoCheckBox);
35 hlayout->addWidget(_frequencySpinBox);
37 vlayout->addItem(hlayout);
40 _timer =
new QTimer(
this);
41 _updateTimerFrequency();
42 _frequencySpinBox->setEnabled(_autoCheckBox->isChecked());
46 connect(_autoCheckBox, &QCheckBox::toggled,
this, &This::_toggleAutoUpdates);
47 connect(_frequencySpinBox,
48 &QDoubleSpinBox::editingFinished,
50 &This::_updateTimerFrequency);
74 return static_cast<int>(std::round(1000 / _frequencySpinBox->value()));
85 if (_autoCheckBox->isChecked())
103 PeriodicUpdateWidget::_updateTimerFrequency()
109 PeriodicUpdateWidget::_toggleAutoUpdates(
bool enabled)
112 _frequencySpinBox->setEnabled(
enabled);
126 return _autoCheckBox;
132 return _frequencySpinBox;