mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 00:40:25 +00:00
27 lines
620 B
C++
27 lines
620 B
C++
#include "spinbox_ui.hpp"
|
|
#include "overload.hpp"
|
|
|
|
SpinBoxUi::SpinBoxUi(QSpinBox *spinbox, Settings *settings, const std::string &opt) :
|
|
TextOptUi(settings, opt),
|
|
spinbox(spinbox)
|
|
{
|
|
updateUiState();
|
|
connectSignals();
|
|
}
|
|
|
|
void SpinBoxUi::connectSignals(){
|
|
connect(spinbox, Overload<const QString &>::of(&QSpinBox::valueChanged),
|
|
this, &SpinBoxUi::textEdited);
|
|
}
|
|
|
|
void SpinBoxUi::updateUiState(const std::string &text){
|
|
if(!text.empty())
|
|
spinbox->setValue(std::stoi(text));
|
|
else
|
|
spinbox->clear();
|
|
}
|
|
|
|
void SpinBoxUi::updateUiState(){
|
|
updateUiState(getOptValue());
|
|
}
|