我无法验证价格。
接受价格示例:10,00 / 100,00 / 1.000,00
不接受:10 / 100 / 1000.00
代码,但是这个传递 100 / 10 / 1000.00
bool ok;
QLocale::setDefault(QLocale(QLocale::Portuguese, QLocale::Brazil));
QLocale brazil; // Constructs a default QLocale
QString text;
if(ui->price->text().length() <= 2){
qDebug() << text.sprintf("%6.2f", ui->price->text().toDouble()); //format 50 = 50.00
}
brazil.toDouble(ui->price->text(), &ok);
qDebug() << ok;