PDA

View Full Version : Line Edit "hint" text



MTK358
20th September 2010, 11:38
How do I make a QLineEdit show some predetermined gray text only when it's unfocused and empty? Kind of like the Filter box above the list of widgets in Qt Designer, so you know what I mean.

wysota
20th September 2010, 12:01
In Qt 4.7 this is a property of the line edit, in older versions you have to subclass QLineEdit and implement it yourself. You can also use QwwButtonLineEdit (http://www.wysota.eu.org/wwwidgets/doc/html/qwwbuttonlineedit.html) and its placeholderText property.