diff --git a/src/calibre/gui2/keyboard.py b/src/calibre/gui2/keyboard.py index c336062da3..b9c1fd0e7d 100644 --- a/src/calibre/gui2/keyboard.py +++ b/src/calibre/gui2/keyboard.py @@ -696,7 +696,7 @@ class ShortcutConfig(QWidget): # {{{ self.view.setModel(self._model) def editor_opened(self, index): - self.view.scrollTo(index, self.view.EnsureVisible) + self.view.scrollTo(index, QAbstractItemView.ScrollHint.EnsureVisible) @property def is_editing(self): @@ -744,7 +744,7 @@ class ShortcutConfig(QWidget): # {{{ idx = self.view.model().index_for_group(group_name) if idx is not None: self.view.expand(idx) - self.view.scrollTo(idx, self.view.PositionAtTop) + self.view.scrollTo(idx, QAbstractItemView.ScrollHint.PositionAtTop) self.view.selectionModel().select(idx, QItemSelectionModel.SelectionFlag.ClearAndSelect) self.view.setCurrentIndex(idx) self.view.setFocus(Qt.FocusReason.OtherFocusReason) diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py index bc1f63a130..6205549378 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -1124,7 +1124,7 @@ class GridView(QListView): return self.set_current_row(row) self.select_rows((row,)) - self.scrollTo(self.model().index(row, 0), self.PositionAtCenter) + self.scrollTo(self.model().index(row, 0), QAbstractItemView.ScrollHint.PositionAtCenter) def marked_changed(self, old_marked, current_marked): changed = old_marked | current_marked diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index fddd04cc7b..2bad0212c3 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -1088,7 +1088,7 @@ class BooksView(QTableView): # {{{ h = self.horizontalHeader() for i in range(h.count()): if not h.isSectionHidden(i) and h.sectionViewportPosition(i) >= 0: - self.scrollTo(self.model().index(row, i), self.PositionAtCenter) + self.scrollTo(self.model().index(row, i), QAbstractItemView.ScrollHint.PositionAtCenter) break @property diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py index aa4c69228f..7001b9092b 100644 --- a/src/calibre/gui2/preferences/plugins.py +++ b/src/calibre/gui2/preferences/plugins.py @@ -10,7 +10,7 @@ import textwrap, os from collections import OrderedDict from PyQt5.Qt import (Qt, QModelIndex, QAbstractItemModel, QIcon, - QBrush, QDialog, QItemSelectionModel) + QBrush, QDialog, QItemSelectionModel, QAbstractItemView) from calibre.gui2.preferences import ConfigWidgetBase, test_widget from calibre.gui2.preferences.plugins_ui import Ui_Form @@ -263,7 +263,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.plugin_view.selectionModel().select(idx, QItemSelectionModel.SelectionFlag.ClearAndSelect) self.plugin_view.setCurrentIndex(idx) self.plugin_view.setFocus(Qt.FocusReason.OtherFocusReason) - self.plugin_view.scrollTo(idx, self.plugin_view.EnsureVisible) + self.plugin_view.scrollTo(idx, QAbstractItemView.ScrollHint.EnsureVisible) def find_next(self, *args): idx = self.plugin_view.currentIndex() diff --git a/src/calibre/gui2/shortcuts.py b/src/calibre/gui2/shortcuts.py index 922f1b30b1..5332398e71 100644 --- a/src/calibre/gui2/shortcuts.py +++ b/src/calibre/gui2/shortcuts.py @@ -305,7 +305,7 @@ class ShortcutConfig(QWidget): type=Qt.ConnectionType.QueuedConnection) def scrollTo(self, index): - self.view.scrollTo(index, self.view.EnsureVisible) + self.view.scrollTo(index, QAbstractItemView.ScrollHint.EnsureVisible) @property def is_editing(self): diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 0c8e3a03c7..f5ac68940b 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -1113,7 +1113,7 @@ class TagsView(QTreeView): # {{{ self.blockSignals(False) def show_item_at_path(self, path, box=False, - position=QTreeView.PositionAtCenter): + position=QAbstractItemView.ScrollHint.PositionAtCenter): ''' Scroll the browser and open categories to show the item referenced by path. If possible, the item is placed in the center. If box=True, a @@ -1133,7 +1133,7 @@ class TagsView(QTreeView): # {{{ self.expand(idx) def show_item_at_index(self, idx, box=False, - position=QTreeView.PositionAtCenter): + position=QAbstractItemView.ScrollHint.PositionAtCenter): if idx.isValid() and idx.data(Qt.ItemDataRole.UserRole) is not self._model.root_item: self.expand_parent(idx) self.setCurrentIndex(idx)