[英]How to change the text of a QLineEdit when the user click on the QLineEdit in Qt?
我有一個QLineEdit
,其文本為“搜索內容...” 。
我QLineEdit
擁有焦點時或當光標移到文本內時,將文本設置為空字符串。 [這有效:我沒問題,我使用了QLineEdit
的cursorPositionChanged
信號]。
我也QLineEdit
離開焦點時,如果文本為空,則QLineEdit
的文本設置為“ Search contents ...” 。 [我不知道該怎么做]。
QLineEdit
的placeholderText
屬性正是您所需要的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.