diff options
Diffstat (limited to 'src/widgets/util/qcompleter.cpp')
-rw-r--r-- | src/widgets/util/qcompleter.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index df280119cb..0daa4a4b41 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1243,7 +1243,14 @@ void QCompleter::setPopup(QAbstractItemView *popup) Qt::FocusPolicy origPolicy = Qt::NoFocus; if (d->widget) origPolicy = d->widget->focusPolicy(); - popup->setParent(nullptr, Qt::Popup); + + // Mark the widget window as a popup, so that if the last non-popup window is closed by the + // user, the application should not be prevented from exiting. It needs to be set explicitly via + // setWindowFlag(), because passing the flag via setParent(parent, windowFlags) does not call + // QWidgetPrivate::adjustQuitOnCloseAttribute(), and causes an application not to exit if the + // popup ends up being the last window. + popup->setParent(nullptr); + popup->setWindowFlag(Qt::Popup); popup->setFocusPolicy(Qt::NoFocus); if (d->widget) d->widget->setFocusPolicy(origPolicy); |