mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
minor modifications of selection
This commit is contained in:
parent
53803f040d
commit
79553d0ce7
1 changed files with 4 additions and 2 deletions
|
|
@ -889,15 +889,17 @@ class ProjectsWidget(QtWidgets.QWidget):
|
|||
self._projects_proxy_model.setFilterFixedString(text)
|
||||
|
||||
def set_selected_project(self, project_name: Optional[str]):
|
||||
selection_model = self._projects_view.selectionModel()
|
||||
if project_name is None:
|
||||
selection_model.clearSelection()
|
||||
self._projects_view.clearSelection()
|
||||
self._projects_view.setCurrentIndex(QtCore.QModelIndex())
|
||||
return
|
||||
|
||||
index = self._projects_model.get_index_by_project_name(project_name)
|
||||
if not index.isValid():
|
||||
return
|
||||
proxy_index = self._projects_proxy_model.mapFromSource(index)
|
||||
if proxy_index.isValid():
|
||||
selection_model = self._projects_view.selectionModel()
|
||||
selection_model.select(
|
||||
proxy_index,
|
||||
QtCore.QItemSelectionModel.ClearAndSelect
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue