Restricting qlineedit by file type
How is it possible to have qlineedit->settext开发者_Python百科()
to accept file of type .ma only?
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...
精彩评论