Commit c99ec64f authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Give initial keyboard focus to the keys filter

By default, the name edit got keyboard focus, but I think it's more
common to search for keys to add to an existing group than to change
the name of an existing group.

GnuPG-bug-id: 5175, 5239
parent b8130ea5
Pipeline #50395 passed with stage
in 17 minutes and 35 seconds
......@@ -231,13 +231,23 @@ void Command::applyWindowID(QWidget *w) const
if (w) {
if (d->parentWId) {
if (QWidget *pw = QWidget::find(d->parentWId)) {
// remember the current focus widget; re-parenting resets it
QWidget *focusWidget = w->focusWidget();
w->setParent(pw, w->windowFlags());
if (focusWidget) {
focusWidget->setFocus();
}
} else {
w->setAttribute(Qt::WA_NativeWindow, true);
KWindowSystem::setMainWindow(w->windowHandle(), d->parentWId);
}
} else {
// remember the current focus widget; re-parenting resets it
QWidget *focusWidget = w->focusWidget();
w->setParent(d->parentWidgetOrView(), w->windowFlags());
if (focusWidget) {
focusWidget->setFocus();
}
}
}
}
......
......@@ -194,6 +194,9 @@ public:
connect(ui.buttonBox, &QDialogButtonBox::accepted, q, &EditGroupDialog::accept);
connect(ui.buttonBox, &QDialogButtonBox::rejected, q, &EditGroupDialog::reject);
// give initial keyboard focus to the keys filter
ui.availableKeysFilter->setFocus();
// calculate default size with enough space for the key list
const auto fm = q->fontMetrics();
const QSize sizeHint = q->sizeHint();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment