Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2022-10-19 01:24:35 +0300
committerJonathan White <support@dmapps.us>2022-10-19 14:01:03 +0300
commit82f056e5d02791c4155f74664a18ab19e9514bd7 (patch)
tree3e110ab75f704e4bcc740d7bb311ace46842a1fc
parentedae652d6f25e5170cdfc5424e59e847983b9a25 (diff)
Allow picking tags from completion menu with keyboard
* Also fixes the hiding and display of the completion menu to be more natural and less annoying. * Fixes #7939
-rw-r--r--src/gui/tag/TagsEdit.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/tag/TagsEdit.cpp b/src/gui/tag/TagsEdit.cpp
index 52fc4853e..7d5b657ce 100644
--- a/src/gui/tag/TagsEdit.cpp
+++ b/src/gui/tag/TagsEdit.cpp
@@ -413,9 +413,9 @@ struct TagsEdit::Impl
void setupCompleter()
{
completer->setWidget(ifce);
- connect(completer.get(), static_cast<void (QCompleter::*)(QString const&)>(&QCompleter::activated), [this](QString const& text) {
- currentText(text);
- });
+ connect(completer.get(),
+ static_cast<void (QCompleter::*)(QString const&)>(&QCompleter::activated),
+ [this](QString const& text) { currentText(text); });
}
QVector<QTextLayout::FormatRange> formatting() const
@@ -861,10 +861,16 @@ void TagsEdit::keyPressEvent(QKeyEvent* event)
case Qt::Key_Enter:
case Qt::Key_Comma:
case Qt::Key_Semicolon:
+ // If completer is visible, accept the selection or hide if no selection
+ if (impl->completer->popup()->isVisible() && impl->completer->popup()->selectionModel()->hasSelection()) {
+ break;
+ }
+
+ // Make existing text into a tag
if (!impl->currentText().isEmpty()) {
impl->editNewTag(impl->editing_index + 1);
+ event->accept();
}
- event->accept();
break;
default:
unknown = true;