Skip to content

Commit

Permalink
Add focus switch on welcome dialog (#1968)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo authored Jul 7, 2024
2 parents dd03c19 + ea89e66 commit 1c261ef
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 1c261ef

Please sign in to comment.