File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3525,15 +3525,20 @@ def scroll_to_index(self, index):
35253525 if index < 0 or index >= self.model.rowCount():
35263526 return
35273527
3528- # QTimer.singleShot을 사용하여 scrollTo를 이벤트 루프의 다음 사이클에서 실행합니다.
3529- # 이렇게 하면 모델/뷰 업데이트가 완료된 후 스크롤이 실행되어 정확성이 높아집니다.
3530- QTimer.singleShot(0, lambda: self._perform_scroll(index))
3528+ # 10ms의 짧은 지연을 추가하여 뷰가 업데이트될 시간을 확실히 보장합니다.
3529+ QTimer.singleShot(10, lambda: self._perform_scroll(index))
35313530
35323531 def _perform_scroll(self, index):
35333532 """실제 스크롤을 수행하는 내부 메서드"""
35343533 # 타이머 콜백 시점에 인덱스가 여전히 유효한지 다시 확인
35353534 if 0 <= index < self.model.rowCount():
35363535 model_index = self.model.createIndex(index, 0)
3536+
3537+ # 1. 뷰에게 현재 인덱스가 무엇인지 명시적으로 알려줍니다.
3538+ # 이렇게 하면 뷰가 스크롤 위치를 계산하기 전에 올바른 아이템에 집중하게 됩니다.
3539+ self.list_view.setCurrentIndex(model_index)
3540+
3541+ # 2. 스크롤을 수행합니다.
35373542 self.list_view.scrollTo(model_index, QListView.PositionAtCenter)
35383543
35393544 def preload_surrounding_thumbnails(self, center_index, radius=5):
You can’t perform that action at this time.
0 commit comments