Commit d4a70301 authored by Dan Pascu's avatar Dan Pascu

Scroll list to selected item after conference DND

parent dee55690
...@@ -454,6 +454,7 @@ class SessionModel(QAbstractListModel): ...@@ -454,6 +454,7 @@ class SessionModel(QAbstractListModel):
self.endInsertRows() self.endInsertRows()
session_list.openPersistentEditor(self.index(position)) session_list.openPersistentEditor(self.index(position))
source.conference = target.conference source.conference = target.conference
session_list.scrollTo(self.index(position), session_list.EnsureVisible) # or PositionAtBottom
else: else:
target_row = index.row() target_row = index.row()
first, last = (source, target) if source_row < target_row else (target, source) first, last = (source, target) if source_row < target_row else (target, source)
...@@ -468,6 +469,7 @@ class SessionModel(QAbstractListModel): ...@@ -468,6 +469,7 @@ class SessionModel(QAbstractListModel):
first.conference = conference first.conference = conference
last.conference = conference last.conference = conference
position = self.sessions.index(source) position = self.sessions.index(source)
session_list.scrollToTop()
session_list.setSelectionMode(selection_mode) session_list.setSelectionMode(selection_mode)
selection_model.select(self.index(position), selection_model.Select) selection_model.select(self.index(position), selection_model.Select)
else: else:
...@@ -488,11 +490,13 @@ class SessionModel(QAbstractListModel): ...@@ -488,11 +490,13 @@ class SessionModel(QAbstractListModel):
self._add_session(first) self._add_session(first)
self._add_session(last) self._add_session(last)
position = self.sessions.index(sibling) position = self.sessions.index(sibling)
session_list.scrollToBottom()
else: else:
source.conference = None source.conference = None
self._pop_session(source) self._pop_session(source)
self._add_session(source) self._add_session(source)
position = self.sessions.index(conference.sessions[0]) position = self.sessions.index(conference.sessions[0])
session_list.scrollTo(self.index(position), session_list.PositionAtCenter)
session_list.setSelectionMode(selection_mode) session_list.setSelectionMode(selection_mode)
selection_model.select(self.index(position), selection_model.Select) selection_model.select(self.index(position), selection_model.Select)
return True return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment