6 #include <QDoubleSpinBox>
16 setSizePolicy(QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Fixed);
18 QLayout* vlayout =
new QVBoxLayout();
19 QLayout* hlayout =
new QHBoxLayout();
20 this->setLayout(vlayout);
23 hlayout->setContentsMargins(margin, margin, margin, margin);
25 _updateButton =
new QPushButton(
"Update",
this);
26 _autoCheckBox =
new QCheckBox(
"Auto Update",
this);
27 _frequencySpinBox =
new QDoubleSpinBox(
this);
28 _collapseAllButton =
new QPushButton(
"Collapse all",
this);
29 _frequencySpinBox->setValue(frequency);
30 _frequencySpinBox->setMinimum(0);
31 _frequencySpinBox->setMaximum(maxFrequency);
32 _frequencySpinBox->setSingleStep(0.5);
33 _frequencySpinBox->setSuffix(
" Hz");
35 hlayout->addWidget(_updateButton);
36 hlayout->addWidget(_autoCheckBox);
37 hlayout->addWidget(_frequencySpinBox);
39 hlayout->addWidget(_collapseAllButton);
40 vlayout->addItem(hlayout);
43 _timer =
new QTimer(
this);
44 _updateTimerFrequency();
45 _frequencySpinBox->setEnabled(_autoCheckBox->isChecked());
49 connect(_autoCheckBox, &QCheckBox::toggled,
this, &This::_toggleAutoUpdates);
50 connect(_frequencySpinBox,
51 &QDoubleSpinBox::editingFinished,
53 &This::_updateTimerFrequency);
78 return _collapseAllButton;
84 return static_cast<int>(std::round(1000 / _frequencySpinBox->value()));
95 if (_autoCheckBox->isChecked())
113 PeriodicUpdateWidget::_updateTimerFrequency()
119 PeriodicUpdateWidget::_toggleAutoUpdates(
bool enabled)
122 _frequencySpinBox->setEnabled(
enabled);
136 return _autoCheckBox;
142 return _frequencySpinBox;