Search code examples
c++qlineedit

Get the value from a QLineEdit


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));

Solution

  • I figured it out:

    QString XMAX=ui->lineEdit->text();
    xMax=XMAX.toDouble();