Get the value from a QLineEdit
Pregunta
I have a QLineEdit
that only allows numbers and I want to get the current value from it. I can't figure out how.
ui->lineEdit->setValidator(new QIntValidator(this));
Solución
I figured it out:
QString XMAX=ui->lineEdit->text();
xMax=XMAX.toDouble();
Otros consejos
Or
std::stod(ui->lineEdit->text().toStdString());
but watch out for the encoding.
Try this:
ui->leNome->displayText()
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow