mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +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)
|
self._projects_proxy_model.setFilterFixedString(text)
|
||||||
|
|
||||||
def set_selected_project(self, project_name: Optional[str]):
|
def set_selected_project(self, project_name: Optional[str]):
|
||||||
selection_model = self._projects_view.selectionModel()
|
|
||||||
if project_name is None:
|
if project_name is None:
|
||||||
selection_model.clearSelection()
|
self._projects_view.clearSelection()
|
||||||
|
self._projects_view.setCurrentIndex(QtCore.QModelIndex())
|
||||||
return
|
return
|
||||||
|
|
||||||
index = self._projects_model.get_index_by_project_name(project_name)
|
index = self._projects_model.get_index_by_project_name(project_name)
|
||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
return
|
return
|
||||||
proxy_index = self._projects_proxy_model.mapFromSource(index)
|
proxy_index = self._projects_proxy_model.mapFromSource(index)
|
||||||
if proxy_index.isValid():
|
if proxy_index.isValid():
|
||||||
|
selection_model = self._projects_view.selectionModel()
|
||||||
selection_model.select(
|
selection_model.select(
|
||||||
proxy_index,
|
proxy_index,
|
||||||
QtCore.QItemSelectionModel.ClearAndSelect
|
QtCore.QItemSelectionModel.ClearAndSelect
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue