Search code examples
qtqt4placeholderqlineedit

QLineEdit placeholder text not working in Qt 4.6.3


I am using Qt 4.6.3, and tried to set some placeholder text on a QLineEdit. But these methods didn't work:

  • using Qt designer (uic)
  • through code ui->lineedit.setPlaceholderText("phtext")
  • setProperty("placeholderText","phtext")

The error is that setPlaceholderText is not a member of the QLineEdit class.

Is this a bug and\or is there a way to fix it?


Solution

  • The placeholderText property was introduced in Qt 4.7 (see documentation), so it doesn't exist in Qt 4.6.