From ea89e66a46c76e30ae0aa5ee41edaf5affa675bf Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:59:35 +0200 Subject: [PATCH] Focus project name field when entering new project form on welcome dialog (#1967) --- novelwriter/tools/welcome.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/novelwriter/tools/welcome.py b/novelwriter/tools/welcome.py index b962e98c0..7e2a20a37 100644 --- a/novelwriter/tools/welcome.py +++ b/novelwriter/tools/welcome.py @@ -208,6 +208,7 @@ def _showNewProjectPage(self) -> None: """Show the create new project page.""" self.mainStack.setCurrentWidget(self.tabNew) self._setButtonVisibility() + self.tabNew.enterForm() return @pyqtSlot() @@ -503,6 +504,8 @@ def __init__(self, parent: QWidget) -> None: self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) + self.enterForm = self.projectForm.enterForm + # Assemble # ======== @@ -696,6 +699,12 @@ def __init__(self, parent: QWidget) -> None: return + def enterForm(self) -> None: + """Focus the project name field when entering the form.""" + self.projName.setFocus() + self.projName.selectAll() + return + def getProjectData(self) -> dict: """Collect form data and return it as a dictionary.""" roots = []