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

Set the initial focus just before showing the dialog for the first time

If the dialog isn't used with the defaults, then another widget may be
selected and thus another widget should initially have the input focus.
Therefore, we defer setting the initial focus until the dialog is shown.

GnuPG-bug-id: 5832
parent d19de25b
......@@ -964,7 +964,6 @@ void AdvancedSettingsDialog::loadDefaults()
loadDefaultExpiration();
updateWidgetVisibility();
setInitialFocus();
}
void AdvancedSettingsDialog::updateWidgetVisibility()
......@@ -1103,3 +1102,12 @@ void AdvancedSettingsDialog::setInitialFocus()
// finally, focus the OK button
ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus();
}
void AdvancedSettingsDialog::showEvent(QShowEvent *event)
{
if (isFirstShowEvent) {
setInitialFocus();
isFirstShowEvent = false;
}
QDialog::showEvent(event);
}
......@@ -115,6 +115,9 @@ private:
void updateWidgetVisibility();
void setInitialFocus();
protected:
void showEvent(QShowEvent *event) override;
private:
struct UI;
std::unique_ptr<UI> ui;
......@@ -125,4 +128,5 @@ private:
bool keyTypeImmutable = false;
bool mECCSupported;
bool mEdDSASupported;
bool isFirstShowEvent = true;
};
Supports Markdown
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