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));
I figured it out:
QString XMAX=ui->lineEdit->text();
xMax=XMAX.toDouble();
Or
std::stod(ui->lineEdit->text().toStdString());
but watch out for the encoding.
Samuel Ives
Try this:
ui->leNome->displayText()
来源:https://stackoverflow.com/questions/12161082/get-the-value-from-a-qlineedit