Skip to content

Commit

Permalink
Focus project name field when entering new project form on welcome di…
Browse files Browse the repository at this point in the history
…alog (#1967)
  • Loading branch information
vkbo committed Jul 7, 2024
1 parent dd03c19 commit ea89e66
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions novelwriter/tools/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
# ========

Expand Down Expand Up @@ -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 = []
Expand Down

0 comments on commit ea89e66

Please sign in to comment.