简体   繁体   中英

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. 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). I have implemented a sub-class deriving from QRegExpValidator, and can successfully obtain the signal when it fails to validate. But how can I implement a dialog like this? Anyone has any idea about this?

Thanks in advance. 在此输入图像描述

您正在寻找的是QToolTip :: showText()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM