From 00589b247a14d2f7ff549740c89f087c2dd8f0bd Mon Sep 17 00:00:00 2001 From: arthomnix Date: Mon, 11 Jul 2022 18:02:20 +0100 Subject: [PATCH] GH-4812 Prefill instance name to allow making adjustments Fills the instance name in instead of just setting a placeholder. This allows adjustments to be made to the suggested name without typing the whole thing out. The text is selected by default so that typing will overwrite the text, but users who want to adjust the default name instead of typing their own can deselect the text. The placeholder name is still set so it is still visible if the user deletes the text. Also sets the focus to the instance name textbox by default, whereas previously it was on the group name - this is required so the text gets overwritten on typing but also makes more sense generally. Closes issue #4812. --- launcher/ui/dialogs/NewInstanceDialog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/launcher/ui/dialogs/NewInstanceDialog.cpp b/launcher/ui/dialogs/NewInstanceDialog.cpp index 0b933fb5..135e8b3d 100644 --- a/launcher/ui/dialogs/NewInstanceDialog.cpp +++ b/launcher/ui/dialogs/NewInstanceDialog.cpp @@ -151,6 +151,9 @@ void NewInstanceDialog::setSuggestedPack(const QString& name, InstanceTask* task { creationTask.reset(task); ui->instNameTextBox->setPlaceholderText(name); + ui->instNameTextBox->setText(name); + ui->instNameTextBox->selectAll(); + ui->instNameTextBox->setFocus(); if(!task) {