mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for Qt 5 bug that prevents using the return key to edit table cells in the main book list
https://bugreports.qt-project.org/browse/QTBUG-40938
This commit is contained in:
parent
6866597563
commit
e9080a686b
@ -24,7 +24,7 @@ from calibre.gui2.library.alternate_views import AlternateViews, setup_dnd_inter
|
|||||||
from calibre.utils.config import tweaks, prefs
|
from calibre.utils.config import tweaks, prefs
|
||||||
from calibre.gui2 import error_dialog, gprefs, FunctionDispatcher
|
from calibre.gui2 import error_dialog, gprefs, FunctionDispatcher
|
||||||
from calibre.gui2.library import DEFAULT_SORT
|
from calibre.gui2.library import DEFAULT_SORT
|
||||||
from calibre.constants import filesystem_encoding
|
from calibre.constants import filesystem_encoding, isosx
|
||||||
from calibre import force_unicode
|
from calibre import force_unicode
|
||||||
|
|
||||||
class HeaderView(QHeaderView): # {{{
|
class HeaderView(QHeaderView): # {{{
|
||||||
@ -1061,6 +1061,18 @@ class BooksView(QTableView): # {{{
|
|||||||
def row_count(self):
|
def row_count(self):
|
||||||
return self._model.count()
|
return self._model.count()
|
||||||
|
|
||||||
|
if isosx:
|
||||||
|
# Qt 5 item view handling of return key on OS X seems to be broken
|
||||||
|
# See https://bugreports.qt-project.org/browse/QTBUG-40938
|
||||||
|
def keyPressEvent(self, ev):
|
||||||
|
if ev.key() in (Qt.Key_Enter, Qt.Key_Return) and self.state() != self.EditingState:
|
||||||
|
ci = self.currentIndex()
|
||||||
|
if ci.isValid() and ci.flags() & Qt.ItemIsEditable:
|
||||||
|
if self.edit(ci, self.EditKeyPressed, ev):
|
||||||
|
ev.accept()
|
||||||
|
return
|
||||||
|
return QTableView.keyPressEvent(self, ev)
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class DeviceBooksView(BooksView): # {{{
|
class DeviceBooksView(BooksView): # {{{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user