diff options
| author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2025-12-15 16:14:16 +0200 |
|---|---|---|
| committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2025-12-15 16:14:16 +0200 |
| commit | 2d66011e197f96cf17b170fe10b6a78354d3117c (patch) | |
| tree | e4737ff487171dc946ef33d9c355de128ab8d6d5 /src/widgets/util/qcompleter.cpp | |
| parent | 8216f5c5249db2c368434129fb6f4e35cb75edfc (diff) | |
| parent | f9e9e1f1a566511d663b32e422f7b054713e5112 (diff) | |
Merge tag 'v6.5.8-lts-lgpl' into 6.56.5
Qt 6.5.8-lts-lgpl release
Diffstat (limited to 'src/widgets/util/qcompleter.cpp')
| -rw-r--r-- | src/widgets/util/qcompleter.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 6bdacb730f7..c659167c5f7 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1360,11 +1360,13 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) return false; } - // Send the event to the widget. If the widget accepted the event, do nothing - // If the widget did not accept the event, provide a default implementation - d->eatFocusOut = false; - (static_cast<QObject *>(d->widget))->event(ke); - d->eatFocusOut = true; + if (d->widget) { + // Send the event to the widget. If the widget accepted the event, do nothing + // If the widget did not accept the event, provide a default implementation + d->eatFocusOut = false; + (static_cast<QObject *>(d->widget))->event(ke); + d->eatFocusOut = true; + } if (!d->widget || e->isAccepted() || !d->popup->isVisible()) { // widget lost focus, hide the popup if (d->widget && (!d->widget->hasFocus() @@ -1416,8 +1418,9 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) #ifdef QT_KEYPAD_NAVIGATION case QEvent::KeyRelease: { - QKeyEvent *ke = static_cast<QKeyEvent *>(e); - if (QApplicationPrivate::keypadNavigationEnabled() && ke->key() == Qt::Key_Back) { + if (d->widget && + QApplicationPrivate::keypadNavigationEnabled() && ke->key() == Qt::Key_Back) { + QKeyEvent *ke = static_cast<QKeyEvent *>(e); // Send the event to the 'widget'. This is what we did for KeyPress, so we need // to do the same for KeyRelease, in case the widget's KeyPress event set // up something (such as a timer) that is relying on also receiving the @@ -1434,7 +1437,8 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) case QEvent::MouseButtonPress: { #ifdef QT_KEYPAD_NAVIGATION - if (QApplicationPrivate::keypadNavigationEnabled()) { + if (d->widget + && QApplicationPrivate::keypadNavigationEnabled()) { // if we've clicked in the widget (or its descendant), let it handle the click QWidget *source = qobject_cast<QWidget *>(o); if (source) { @@ -1463,7 +1467,8 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) return true; case QEvent::InputMethod: case QEvent::ShortcutOverride: - QCoreApplication::sendEvent(d->widget, e); + if (d->widget) + QCoreApplication::sendEvent(d->widget, e); break; default: |
