tags:

views:

33

answers:

1

How is it possible to have qlineedit->settext() to accept file of type .ma only?

+2  A: 

I assume you want the string to be of the format <filename>.ma in the QLineEdit.

If that's the case, you can use

void QLineEdit::setValidator ( const QValidator * v )

Also, QRegExpValidator can validate for specific strings.

I am not well versed with RegExp but I guess QRegExp rx("*.ma"); as an Regular Expression will be fine for your case.

Hope it helps...

liaK
you might need `rx.setPatternSyntax(QRegExp::Wildcard);`, or you use a real regulare expression instead of a wildcard syntax.
smerlin
@ smerlin, Yep.. Thanks.. :)
liaK