diff options
author | Wang ChunLin <wangchunlin@uniontech.com> | 2020-09-22 14:57:26 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-09-25 07:31:29 +0000 |
commit | 0790249acf069d89f6debc98eab4caf5b8ca2712 (patch) | |
tree | 215424bd8975a97614bbb089a9829f26792f4293 /src | |
parent | 61be29d3650426dc54d46fdc9638ce66ecf588f4 (diff) |
fix QComboBox currentText return placeholderText
If it does not add item,the currentText should return empty string
Fixes: QTBUG-86580
Change-Id: I54c3a8b7ececfb1e62bcd7ac592feccaff3f8b48
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 789d487cb0f4ef6f9d3e7c6ab5c5283dfe8dd350)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 189c3925c3..474a538fb2 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2346,10 +2346,9 @@ QString QComboBox::currentText() const Q_D(const QComboBox); if (d->lineEdit) return d->lineEdit->text(); - else if (d->currentIndex.isValid()) + if (d->currentIndex.isValid()) return d->itemText(d->currentIndex); - else - return d->placeholderText; + return {}; } /*! |