mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Get returnpressed working
This commit is contained in:
parent
a8942bbb7e
commit
658feb70e5
@ -91,7 +91,12 @@ class ResultsList(QTreeWidget):
|
|||||||
self.edit_note(item)
|
self.edit_note(item)
|
||||||
|
|
||||||
def show_context_menu(self, pos):
|
def show_context_menu(self, pos):
|
||||||
raise NotImplementedError('TODO: Implement me')
|
# TODO: Add edit and export items
|
||||||
|
m = QMenu(self)
|
||||||
|
m.addSeparator()
|
||||||
|
m.addAction(QIcon.ic('plus.png'), _('Expand all'), self.expandAll)
|
||||||
|
m.addAction(QIcon.ic('minus.png'), _('Collapse all'), self.collapseAll)
|
||||||
|
m.exec(self.mapToGlobal(pos))
|
||||||
|
|
||||||
def show_next(self, backwards=False):
|
def show_next(self, backwards=False):
|
||||||
item = self.currentItem()
|
item = self.currentItem()
|
||||||
@ -269,7 +274,7 @@ class SearchInput(QWidget):
|
|||||||
self.search_box = sb = SearchBox(self)
|
self.search_box = sb = SearchBox(self)
|
||||||
sb.initialize('library-notes-browser-search-box')
|
sb.initialize('library-notes-browser-search-box')
|
||||||
sb.cleared.connect(self.cleared, type=Qt.ConnectionType.QueuedConnection)
|
sb.cleared.connect(self.cleared, type=Qt.ConnectionType.QueuedConnection)
|
||||||
sb.lineEdit().returnPressed.connect(self.show_next)
|
sb.lineEdit().returnPressed.connect(self.search_changed)
|
||||||
sb.lineEdit().setPlaceholderText(_('Enter words to search for'))
|
sb.lineEdit().setPlaceholderText(_('Enter words to search for'))
|
||||||
h.addWidget(sb)
|
h.addWidget(sb)
|
||||||
|
|
||||||
@ -428,6 +433,13 @@ class NotesBrowser(Dialog):
|
|||||||
err.query, 'https://www.sqlite.org/fts5.html#full_text_query_syntax'),
|
err.query, 'https://www.sqlite.org/fts5.html#full_text_query_syntax'),
|
||||||
det_msg=str(err), show=True)
|
det_msg=str(err), show=True)
|
||||||
|
|
||||||
|
def keyPressEvent(self, ev):
|
||||||
|
k = ev.key()
|
||||||
|
if k in (Qt.Key.Key_Enter, Qt.Key.Key_Return): # prevent enter from closing dialog
|
||||||
|
ev.ignore()
|
||||||
|
return
|
||||||
|
return super().keyPressEvent(ev)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from calibre.library import db
|
from calibre.library import db
|
||||||
|
Loading…
x
Reference in New Issue
Block a user