PIVariantEdit for EvalSpinBox support precision and singleStep

This commit is contained in:
2023-04-20 20:21:05 +03:00
parent 2f630435bb
commit 54e192514f
2 changed files with 5 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
project(QAD) project(QAD)
set(QAD_MAJOR 2) set(QAD_MAJOR 2)
set(QAD_MINOR 16) set(QAD_MINOR 16)
set(QAD_REVISION 0) set(QAD_REVISION 1)
set(QAD_SUFFIX ) set(QAD_SUFFIX )
set(QAD_COMPANY SHS) set(QAD_COMPANY SHS)
set(QAD_DOMAIN org.SHS) set(QAD_DOMAIN org.SHS)

View File

@@ -136,6 +136,8 @@ PIVariantMap PIVariantEditors::NumberBase::attributes() const {
auto * w = qobject_cast<EvalSpinBox *>(widget); auto * w = qobject_cast<EvalSpinBox *>(widget);
if (w) { if (w) {
ret[Attribute::expression] = Q2PIString(w->expression()); ret[Attribute::expression] = Q2PIString(w->expression());
ret[Attribute::singleStep] = w->singleStep();
ret[Attribute::decimals] = w->precision();
} }
} break; } break;
case tScrollSpinBox: { case tScrollSpinBox: {
@@ -250,6 +252,8 @@ void PIVariantEditors::NumberBase::applyAttributes(const PIVariantMap & a) {
case tEvalSpinBox: { case tEvalSpinBox: {
auto * w = qobject_cast<EvalSpinBox *>(widget); auto * w = qobject_cast<EvalSpinBox *>(widget);
if (!w) return; if (!w) return;
w->setSingleStep(step);
w->setPrecision(dec);
w->setExpression(PI2QString(a.value(Attribute::expression).toString())); w->setExpression(PI2QString(a.value(Attribute::expression).toString()));
} break; } break;
case tScrollSpinBox: { case tScrollSpinBox: {