[英]How can I implement a dialog like Windows when I input an invalid file name with QT?
I'm a QT programmer, now I need to enable users to specify a name for an object in my program. 我是QT程序员,现在我需要让用户在程序中指定对象的名称。 There's a rule that the name can only contain several characters, and if user inputs an invalid character, I want to pop up a dialog to indicate the error, like Windows does (see the attached image).
有一条规则,名称只能包含多个字符,如果用户输入了无效字符,我想弹出一个对话框来指示错误,就像Windows一样(参见附图)。 I have implemented a sub-class deriving from QRegExpValidator, and can successfully obtain the signal when it fails to validate.
我已经实现了一个从QRegExpValidator派生的子类,并且可以在无法验证时成功获取信号。 But how can I implement a dialog like this?
但是我该如何实现这样的对话框呢? Anyone has any idea about this?
有人对此有任何想法吗?
Thanks in advance. 提前致谢。
您正在寻找的是QToolTip :: showText()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.