Skip to content

Commit

Permalink
Small refactor of the selection logic in Profile editor, to clear the…
Browse files Browse the repository at this point in the history
… selection when calling self.select_profile()
  • Loading branch information
jonoomph committed Oct 11, 2024
1 parent a1ab05a commit d533abd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/windows/views/profiles_treeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ def on_rows_inserted(self, parent, first, last):

# Select the newly inserted row
if self.last_inserted_row_index.isValid():
self.selectionModel().clear()
self.select_profile(self.last_inserted_row_index)
self.selectionModel().select(self.last_inserted_row_index, QItemSelectionModel.Select)
self.scrollTo(self.last_inserted_row_index)

def refresh_view(self, filter_text=""):
"""Filter transitions with proxy class"""
Expand All @@ -79,7 +76,10 @@ def refresh_view(self, filter_text=""):

def select_profile(self, profile_index):
"""Select a specific profile Key"""
self.selectionModel().clear()
self.selectionModel().setCurrentIndex(profile_index, QItemSelectionModel.Select | QItemSelectionModel.Rows)
self.selectionModel().select(profile_index, QItemSelectionModel.Select)
self.scrollTo(profile_index)

def get_profile(self):
"""Return the selected profile object, if any"""
Expand Down

0 comments on commit d533abd

Please sign in to comment.