2 #include <score/widgets/MarginLess.hpp>
4 #include <ossia/detail/optional.hpp>
21 , m_check{
new QCheckBox{
this}}
22 , m_spin{
new QSpinBox{
this}}
26 lay->addWidget(m_check);
27 lay->addWidget(m_spin);
28 m_spin->setSizePolicy(QSizePolicy::MinimumExpanding, {});
29 m_spin->setSuffix(
"ms");
30 m_spin->setRange(1, 5000);
31 lay->setStretch(0, 1);
32 lay->setStretch(1, 20);
34 connect(m_check, &QCheckBox::toggled,
this, [
this](
bool t) {
35 rateChanged(std::optional<int>{});
36 m_spin->setEnabled(t);
39 m_check->setChecked(
false);
40 m_spin->setEnabled(
false);
45 std::optional<int> rate()
const noexcept
47 if(!m_check->isChecked())
49 return std::optional<int>{};
53 return m_spin->value();
57 void setRate(std::optional<int> r) noexcept
61 m_check->setChecked(
true);
66 m_check->setChecked(
false);
70 void rateChanged(std::optional<int> v) W_SIGNAL(rateChanged, v);
79 W_REGISTER_ARGTYPE(std::optional<int>)