diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-10-17 22:12:43 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-10-19 08:11:27 +0000 |
commit | 64f6169f61ce8c982a1b92b20f930518a5f0d477 (patch) | |
tree | 74e0674e88899e69db50bad6403e36269263333c /src/widgets/widgets/qcombobox.cpp | |
parent | f5962d05d37f62cd6dcd0135974fe781e648f1d4 (diff) |
Warn when setting a completer on non-editable QComboBox
This is not valid, but was confusing before and would be silently ignored,
warn instead.
Fixes: QTBUG-50583
Change-Id: If78c4a5ef96c76e1d5116a1bd24e5c289ff74cc4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets/widgets/qcombobox.cpp')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index e20a0892b4..645b1a8c9e 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1941,12 +1941,15 @@ const QValidator *QComboBox::validator() const performs case insensitive inline completion is automatically created. \note The completer is removed when the \l editable property becomes \c false. + Setting a completer on a QComboBox that is not editable will be ignored. */ void QComboBox::setCompleter(QCompleter *c) { Q_D(QComboBox); - if (!d->lineEdit) + if (!d->lineEdit) { + qWarning("Setting a QCompleter on non-editable QComboBox is not allowed."); return; + } d->lineEdit->setCompleter(c); if (c) { connect(c, SIGNAL(activated(QModelIndex)), this, SLOT(_q_completerActivated(QModelIndex))); |