mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:03:23 +00:00
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:
parent
803727395b
commit
941aaf5b65
1 changed files with 14 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue