Skip to content

Commit

Permalink
fix scrolling on header index changed
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjinliu committed Sep 20, 2024
1 parent 40221cb commit e1d03b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tabulous/_qt/_table/_base/_enhanced_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ def _on_moved(self, src: Index, dst: Index) -> None:
model = self.model()
index_src = model.index(*src.as_uint())
index_dst = model.index(*dst.as_uint())
if dst >= (0, 0) and self.hasFocus():
self.scrollTo(index_dst)
if dst >= (0, 0):
if self.hasFocus():
self.scrollTo(index_dst)
elif dst.row < 0:
self.scrollTo(model.index(0, dst.column))
elif dst.column < 0:
self.scrollTo(model.index(dst.row, 0))

# rect is the region that needs to be updated
rect: QtCore.QRect = self.visualRect(index_dst)
Expand Down

0 comments on commit e1d03b0

Please sign in to comment.