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
edae652d6f
commit
82f056e5d0
@ -413,9 +413,9 @@ struct TagsEdit::Impl
|
|||||||
void setupCompleter()
|
void setupCompleter()
|
||||||
{
|
{
|
||||||
completer->setWidget(ifce);
|
completer->setWidget(ifce);
|
||||||
connect(completer.get(), static_cast<void (QCompleter::*)(QString const&)>(&QCompleter::activated), [this](QString const& text) {
|
connect(completer.get(),
|
||||||
currentText(text);
|
static_cast<void (QCompleter::*)(QString const&)>(&QCompleter::activated),
|
||||||
});
|
[this](QString const& text) { currentText(text); });
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QTextLayout::FormatRange> formatting() const
|
QVector<QTextLayout::FormatRange> formatting() const
|
||||||
@ -861,10 +861,16 @@ void TagsEdit::keyPressEvent(QKeyEvent* event)
|
|||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
case Qt::Key_Comma:
|
case Qt::Key_Comma:
|
||||||
case Qt::Key_Semicolon:
|
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()) {
|
if (!impl->currentText().isEmpty()) {
|
||||||
impl->editNewTag(impl->editing_index + 1);
|
impl->editNewTag(impl->editing_index + 1);
|
||||||
}
|
|
||||||
event->accept();
|
event->accept();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
unknown = true;
|
unknown = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user