From 64f6169f61ce8c982a1b92b20f930518a5f0d477 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 17 Oct 2018 22:12:43 +0200 Subject: [PATCH] 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 --- src/widgets/widgets/qcombobox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)));