mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix infinite loop when tabbing past last cell
This commit is contained in:
parent
0ff4424a64
commit
f68bc23853
@ -1679,8 +1679,4 @@ class DeviceBooksView(BooksView): # {{{
|
|||||||
h = self.horizontalHeader()
|
h = self.horizontalHeader()
|
||||||
h.setSortIndicator(
|
h.setSortIndicator(
|
||||||
h.sortIndicatorSection(), Qt.SortOrder.AscendingOrder if h.sortIndicatorOrder() == Qt.SortOrder.DescendingOrder else Qt.SortOrder.DescendingOrder)
|
h.sortIndicatorSection(), Qt.SortOrder.AscendingOrder if h.sortIndicatorOrder() == Qt.SortOrder.DescendingOrder else Qt.SortOrder.DescendingOrder)
|
||||||
|
|
||||||
def closeEditor(self, editor, hint):
|
|
||||||
return super().closeEditor(editor, hint)
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# License: GPLv3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPLv3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
|
||||||
from qt.core import QAbstractItemDelegate, QSplitter, Qt, QTableView
|
from qt.core import QAbstractItemDelegate, QModelIndex, QSplitter, Qt, QTableView
|
||||||
|
|
||||||
from calibre.gui2 import gprefs
|
from calibre.gui2 import gprefs
|
||||||
from calibre.gui2.library import DEFAULT_SORT
|
from calibre.gui2.library import DEFAULT_SORT
|
||||||
@ -52,7 +52,7 @@ class TableView(QTableView):
|
|||||||
row -= 1
|
row -= 1
|
||||||
col += len(self.column_map)
|
col += len(self.column_map)
|
||||||
if col >= len(self.column_map):
|
if col >= len(self.column_map):
|
||||||
if row >= len(self.column_map) - 1:
|
if row >= m.rowCount(QModelIndex()) - 1:
|
||||||
return
|
return
|
||||||
row += 1
|
row += 1
|
||||||
col -= len(self.column_map)
|
col -= len(self.column_map)
|
||||||
@ -71,8 +71,7 @@ class TableView(QTableView):
|
|||||||
if idx.isValid():
|
if idx.isValid():
|
||||||
# Tell the delegate to ignore keyboard modifiers in case
|
# Tell the delegate to ignore keyboard modifiers in case
|
||||||
# Shift-Tab is being used to move the cell.
|
# Shift-Tab is being used to move the cell.
|
||||||
d = self.itemDelegateForIndex(idx)
|
if (d := self.itemDelegateForIndex(idx)) is not None:
|
||||||
if d is not None:
|
|
||||||
d.ignore_kb_mods_on_edit = True
|
d.ignore_kb_mods_on_edit = True
|
||||||
self.setCurrentIndex(idx)
|
self.setCurrentIndex(idx)
|
||||||
self.edit(idx)
|
self.edit(idx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user