Unsolved online changeable Qlabel or qlineedit
-
how can i have a QLabel or Qlineedit that i can change its text online to new number.
for example first value is "0" when i set the text to 432.1 (in Qlabel or Qline ) in gui the new number show in command line.
thanks -
Hi,
If it's a number input you should consider using QSpinBox or QDoubleSpinBox.
As for your question, do you mean connecting your widget a slot that would do something like
qDebug() << newValue
? -
@SGaist
thanks
my inputs are number. but i want to use Qlabel or Qlineedit to get float number from user and user can change value online. when value change , show it by qDebug()... -
Then QDoubleSpinBox is what you want.
As for the rest, please read the Signals And Slots chapter of Qt's documentation.
-
Hi
And when you read about signals and slots so you know what's it about,
you can use the help to get the connect statement as its a bit funky due as there are 2 versions. (overloads)https://doc.qt.io/qt-5/qdoublespinbox.html#valueChanged
connect(ui->doubleSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](double d){ qDebug() << d; });
This uses a lambda for the slot.
it will print in the Application output.
-
hi thank's
How can i use float Numbers? -
@TahaLotfi
Hi
it already uses doubles.
so that should also work for float type.