Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.0 RC2, 6.1.3
-
None
-
-
d54bb53247 (qt/qtbase/dev) 4d210319e6 (qt/qtbase/6.2) 4d210319e6 (qt/tqtc-qtbase/6.2) d54bb53247 (qt/tqtc-qtbase/dev)
Description
If empty text is set before setting the placeHolderText then the placeHolderText is not visible:
#include <QApplication> #include <QPlainTextEdit> int main(int argc, char *argv[]) { QApplication a(argc, argv); QPlainTextEdit w; w.setPlainText(""); w.setPlaceholderText("Qt is awesome!!!"); w.show(); return a.exec(); }
If instead if I reverse the order the placeHolderText is visible:
w.setPlaceholderText("Qt is awesome!!!");
w.setPlainText("");
Reviewing the source code I discovered that in setPlaceholderText the variable placeholderVisible is not reevaluated causing this unexpected behavior.
so a possible solution would be to invoke QPlainTextEditPrivate:: _q_textChanged in QPlainTextEdit::setPlaceholderText
Attachments
For Gerrit Dashboard: QTBUG-96212 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
369936,25 | QPlainTextEdit: fix the visibility of placeholderText | dev | qt/qtbase | Status: MERGED | +2 | 0 |
395237,2 | QPlainTextEdit: fix the visibility of placeholderText | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
395238,2 | QPlainTextEdit: fix the visibility of placeholderText | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
395239,2 | QPlainTextEdit: fix the visibility of placeholderText | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: ABANDONED | +2 | 0 |