desktop: let tag-widget completion popup accept composition events

Attn: horrible hack!

For some reason the completion-popup does not have the
Qt::WA_InputMethodEnabled flag set. Thus, if the popup is open
composition of characters breaks.

Therefore, when starting completion, explicitly set the flag
on the popup.

This is 100% not how this was intended, but seems to work for
now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-08-13 19:20:35 +02:00 committed by Dirk Hohndel
parent 803727395b
commit 941aaf5b65

View file

@ -96,6 +96,18 @@ void TagWidget::inputMethodEvent(QInputMethodEvent *e)
reparse();
}
// Call complete on a QCompleter and set the WA_InputMethodEnabled on
// the popup if a popup is opened. We need that flag, otherwise composition
// events are not forwarded to the widget and the user cannot enter
// multi-key characters as long as the popup is active.
static void complete(QCompleter *completer)
{
completer->complete();
QWidget *popup = completer->popup();
if (popup)
popup->setAttribute(Qt::WA_InputMethodEnabled);
}
void TagWidget::reparse()
{
highlight();
@ -112,10 +124,10 @@ void TagWidget::reparse()
if (popup)
popup->hide();
} else {
m_completer->complete();
complete(m_completer);
}
} else {
m_completer->complete();
complete(m_completer);
}
}
}