[Solved]Hiding default value of QLineEdit
-
Hi
I have attached text './Projects' to QLineEdit object and I have set place holder "Enter the project path". Now place holder text is not visible but text './Projects' is always kept displaying. My actual requirement is to set default value of './Projects' to qlineedit object (i.e to take this value when user doesn't enter any) and keep on displaying place holder text.How can I do this?
Thank you !!!
-
From the documentation for placeholderText : QString:
"This property holds the line edit's placeholder text.
Setting this property makes the line edit display a grayed-out placeholder text as long as the line edit is empty."
So, setting the text means the place holder text isn't shown any more.
You can check whether the value is empty before you use it. If it is empty you use your default value.