Setting this property makes the line edit display a grayed-out placeholder text as long as the text() is empty and the widget doesn’t have focus.

方法一

ui->lineEdit->setPlaceholderText("hello furong");

方法二
QLineEdit默认提示 setPlaceholderText_编程
效果
QLineEdit默认提示 setPlaceholderText_编程_02