DigviJay Patil
DigviJay Patil

Reputation: 1006

How to get text (Regular Expression) from QInputDialog

I want to know is there any way to get formatted text from QInputDialog that is I want integer with comma as string from Dialog. Or can we apply regular expression to QInputDialog in Text Mode. If not please suggest better way to implement this scenario.

Thank you !

Upvotes: 1

Views: 879

Answers (1)

Jablonski
Jablonski

Reputation: 18504

Try this.

QString result = QString::number(QInputDialog::getInt(this,"title","write"))+QString(",");//we enter for example 9
qDebug() << result; //we get "9,"

Or this

QString result = QString::number(QInputDialog::getDouble(this,"title","write")).replace(".",",");//we enter for example 3.3 (3,3 in the inputDialog)
qDebug() << result;//result 3,3 (not 3.3)

Upvotes: 1

Related Questions