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 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.
© 2022 - 2024 — McMap. All rights reserved.