PDA

View Full Version : How to set the PlaceHolderText for a TextEdit?



JavidRoshan
19th November 2012, 14:57
Can anyone Please suggest me how to set the PlaceHolderText for a QTextEdit.

QLineEdit has a Property setPlaceHolderText, But why the QTextEdit didn’t have that?

If i want to set a PlaceHolderText for TextEdit, How can i set this?

Thanks & Regards,,,,

amleto
19th November 2012, 16:25
qtextedit doesn't have a placeholder member. You will have to do it manually/

JavidRoshan
20th November 2012, 09:34
Yeah i know that. But how to do that? Whether i have to use the focusInEvent for that?

amleto
20th November 2012, 12:10
yes, you will have to use focus events because that affects the behaviour of placeholder in LineEdit

wysota
20th November 2012, 23:20
I don't think using focus events is required. It should be enough to reimplement the paint event and there check if the widget has focus to decide what to draw.