Project

General

Profile

WDoubleSpinBox shows "nan" value if its buttons are pressed

Added by Adriano Tomasi over 4 years ago

Hello everyone.

I have problems concerning strange behavior with all WDoubleSpinBox in my Wt interface.

Wt::WDoubleSpinBox *doubleSpinBoxOffsetZ_;
Wt::WContainerWidget *containerLayoutOffset_;
Wt::WHBoxLayout *horizontalLayoutOffset_;

containerLayoutOffset_ = root()->addWidget(Wt::cpp14::make_unique<Wt::WContainerWidget>());
horizontalLayoutOffset_ = containerLayoutOffset_->setLayout(Wt::cpp14::make_unique<Wt::WHBoxLayout>());

doubleSpinBoxOffsetZ_ = horizontalLayoutOffset_->addWidget(Wt::cpp14::make_unique<Wt::WDoubleSpinBox>());
doubleSpinBoxOffsetZ_->valueChanged().connect(this, &MyWtInterface::onDoubleSpinBoxOffsetZValueChanged);
doubleSpinBoxOffsetZ_->setRange(-100.0, 100.0);
doubleSpinBoxOffsetZ_->setSingleStep(1.0);
doubleSpinBoxOffsetZ_->setMaximumSize(SPIN_BOX_WIDTH, SPIN_BOX_HEIGHT);
doubleSpinBoxOffsetZ_->setMinimumSize(SPIN_BOX_WIDTH, SPIN_BOX_HEIGHT);

All things are created in the right way but when I click on the up/down arrow of the Double Spin Box, it shows the value "nan".

Everything works perfectly if I manually write the value in the box and press enter or if I set the value with the method setValue();

I use also WSpinBox but they works perfectly also with their buttons.

I tested it on Firefox, Chromium and Google Chrome.

I work on Ubuntu 19.04 with Wt 4.1.1.

Has anyone encountered the same behavior?

Thanks in advance for the help.