mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
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
This commit is contained in:
parent
5e9fa18a4d
commit
1af985fde9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user