Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.0
-
None
-
789d487cb0f4ef6f9d3e7c6ab5c5283dfe8dd350 (qt/qtbase/dev) 0790249acf069d89f6debc98eab4caf5b8ca2712 (qt/qtbase/5.15)
Description
QComboBox::setPlaceholderText() was introduced in 5.15, but has the following bug:
When using it, QComboBox::currentText() will change.
This is unexpected and different than the QLineEdit behaviour.
The placeholder text should never leak out, as it's not data, it's just a visual aid.
#include <QDebug> #include <QApplication> #include <QComboBox> #include <QLineEdit> int main(int a, char **b) { QApplication app(a, b); QLineEdit l; l.setPlaceholderText("foo"); QComboBox c; c.setPlaceholderText("foo"); qDebug() << c.currentText() << l.text(); // Prints "foo" "" return 0; }