开发者

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜