New*_*oon 6 qt4 qtextedit qt4.7
我想设置 a 的占位符文本QTextEdit。我知道如何为 a 设置它QLineEdit,有一个属性setPlaceHolderText。但此属性不适用于QTextEdit。请提出您宝贵的建议以解决此问题。
使用QTextEdit的setTextCursor(QTextCursor&)函数。使用以下逻辑。
QTextCursor textCursor;
textCursor.setPosistion(0, QTextCursor::MoveAnchor);
textedit->setTextCursor( textCursor );
Run Code Online (Sandbox Code Playgroud)