PDA

View Full Version : Qt Designer How to display an icon or image in a Windows Form using Qt Designer?



gussabina
1st September 2020, 20:29
Hello:

I'm creating a Windows Form in Qt Designer, and I would wish to add a check mark icon (or red cross icon) to validate an entry in an edit field. What control can I use to display this icon or image?

Thanks
Gus

d_stranz
2nd September 2020, 18:04
Use a QLabel with a QPixmap and place it in a layout next to the line edit. You can set the pixmap to be a check mark, an X, or nothing depending on how you want to display the status of the edit field's contents.

You could also think about using a QValidator or a QCompleter on the line edit if that is feasible to prevent the user from entering the wrong thing in the first place.