2#include <Gui/RaGui.hpp>
6#include <Gui/Widgets/QtTypeWrapper.hpp>
21 using BaseWidget =
typename QtSpinBox::getType<T>::Type;
23 using BaseWidget::BaseWidget;
24 QValidator::State validate( QString& input,
int& )
const override;
33 inline bool isValid( T s )
const {
return m_p( s ); }
36 Predicate m_p = []( T ) {
return true; };
40QValidator::State ConstrainedNumericSpinBox<T>::validate( QString& input,
int& )
const {
41 auto valid = this->isValid( this->valueFromText( input ) );
42 auto& spin =
const_cast<ConstrainedNumericSpinBox&
>( *this );
43 spin.blockSignals( !valid );
44 if ( valid ) { spin.setStyleSheet(
"" ); }
45 else { spin.setStyleSheet(
"background-color: #FF8080" ); }
46 return valid ? QValidator::Acceptable : QValidator::Invalid;
hepler function to manage enum as underlying types in VariableSet