[Solved] QInputDialog::getText() and QRegExp

I am using QInputDialog::getText() to get a string from the user. I would like to add some constraints on the string, using a QRegExp, but according to the doc, there is no such feature with QInputDialog (Qt::InputMethodHints doesn't fit my needs). What is the better way to do such a thing?

I think, you should use QRegExp by your input object (e.g. QLineEdit, QTextEdit).
It contrains the editing of the object, so the user cannot type in wrong characters

EDIT: Another way is to check, if the string is in the right format:
[code] QRegExp rx("*.txt");
rx.setPatternSyntax(QRegExp::Wildcard);
rx.exactMatch("README.txt"); // returns true
rx.exactMatch("welcome.txt.bak"); // returns false[/code]
See also: http://qt-project.org/doc/qt-4.8/qregexp.html

Hi,
The way to go is probably to catch the close event and check with a QRegExp the stuff that is inserted (like Serenity does). When the string is oke (or empty to escape it) you can accept the close event. If not you could ignore the event with maybe an information box on top to indicate that the user should do it right this time. Or maybe catch some other event or signal (inputchanged or something).
Greetz