mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1503910 [Cmd+T doesn't toggle TOC back off when in window mode](https://bugs.launchpad.net/calibre/+bug/1503910)
This commit is contained in:
parent
581ecb67b1
commit
c5fb9e75de
@ -138,6 +138,17 @@ class EbookViewer(MainWindow):
|
||||
self.search.focus_to_library.connect(lambda: self.view.setFocus(Qt.OtherFocusReason))
|
||||
self.toc.pressed[QModelIndex].connect(self.toc_clicked)
|
||||
self.toc.searched.connect(partial(self.toc_clicked, force=True))
|
||||
def toggle_toc(ev):
|
||||
try:
|
||||
key = self.view.shortcuts.get_match(ev)
|
||||
except AttributeError:
|
||||
pass
|
||||
if key == 'Table of Contents':
|
||||
ev.accept()
|
||||
self.action_table_of_contents.trigger()
|
||||
return True
|
||||
return False
|
||||
self.toc.handle_shortcuts = toggle_toc
|
||||
self.reference.goto.connect(self.goto)
|
||||
self.bookmarks.edited.connect(self.bookmarks_edited)
|
||||
self.bookmarks.activated.connect(self.goto_bookmark)
|
||||
|
@ -95,6 +95,14 @@ class TOCView(QTreeView):
|
||||
m.addAction(_('Collapse all items'), self.collapseAll)
|
||||
m.exec_(self.mapToGlobal(pos))
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
try:
|
||||
if self.handle_shortcuts(event):
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
return QTreeView.keyPressEvent(self, event)
|
||||
|
||||
class TOCSearch(QWidget):
|
||||
|
||||
def __init__(self, toc_view, parent=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user