Skip to content

Commit d533abd

Browse files
committed
Small refactor of the selection logic in Profile editor, to clear the selection when calling self.select_profile()
1 parent a1ab05a commit d533abd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/windows/views/profiles_treeview.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ def on_rows_inserted(self, parent, first, last):
5353

5454
# Select the newly inserted row
5555
if self.last_inserted_row_index.isValid():
56-
self.selectionModel().clear()
5756
self.select_profile(self.last_inserted_row_index)
58-
self.selectionModel().select(self.last_inserted_row_index, QItemSelectionModel.Select)
59-
self.scrollTo(self.last_inserted_row_index)
6057

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

8077
def select_profile(self, profile_index):
8178
"""Select a specific profile Key"""
79+
self.selectionModel().clear()
8280
self.selectionModel().setCurrentIndex(profile_index, QItemSelectionModel.Select | QItemSelectionModel.Rows)
81+
self.selectionModel().select(profile_index, QItemSelectionModel.Select)
82+
self.scrollTo(profile_index)
8383

8484
def get_profile(self):
8585
"""Return the selected profile object, if any"""

0 commit comments

Comments
 (0)