From 8f66241dc21be71176f1e18e3e14ba27bb37c4c4 Mon Sep 17 00:00:00 2001 From: Acly Date: Thu, 23 Jan 2025 16:49:35 +0100 Subject: [PATCH] Make TAB key work for auto-completion #1525 --- ai_diffusion/ui/widget.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ai_diffusion/ui/widget.py b/ai_diffusion/ui/widget.py index 1ea459afb..0a674b151 100644 --- a/ai_diffusion/ui/widget.py +++ b/ai_diffusion/ui/widget.py @@ -387,7 +387,7 @@ def event(self, e: QEvent | None): # Ctrl+Backspace should be handled by QPlainTextEdit, not Krita. if e.type() == QEvent.Type.ShortcutOverride: assert isinstance(e, QKeyEvent) - if e.matches(QKeySequence.DeleteStartOfWord): + if e.matches(QKeySequence.StandardKey.DeleteStartOfWord): e.accept() return super().event(e) @@ -414,6 +414,11 @@ def focusOutEvent(self, e): if scroll := self.verticalScrollBar(): scroll.triggerAction(QScrollBar.SliderAction.SliderToMinimum) + def focusNextPrevChild(self, next): + if self._completer.is_active: + return False + return super().focusNextPrevChild(next) + def notify_text_changed(self): self._completer.check_completion() self.text_changed.emit(self.text)