Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个QLineEdit只允许数字的,我想从中获取当前值。我不知道怎么做。
QLineEdit
ui->lineEdit->setValidator(new QIntValidator(this));
我想到了:
QString XMAX=ui->lineEdit->text(); xMax=XMAX.toDouble();
或者
std::stod(ui->lineEdit->text().toStdString());
但要注意编码。
试试这个:
ui->leNome->displayText()