mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 21:43:51 +02:00
Show a tooltip for the group headings in the search results list
This commit is contained in:
parent
1a39df6e83
commit
5378316da0
1 changed files with 7 additions and 1 deletions
|
|
@ -516,12 +516,18 @@ def add_result(self, result):
|
|||
section_id = toc_nodes[-1].get('id')
|
||||
if section_id is None:
|
||||
section_id = -1
|
||||
section_key = section_id, section_title
|
||||
section_key = section_id
|
||||
section = self.section_map.get(section_key)
|
||||
if section is None:
|
||||
section = QTreeWidgetItem([section_title], 1)
|
||||
section.setFlags(Qt.ItemIsEnabled)
|
||||
section.setFont(0, self.section_font)
|
||||
lines = []
|
||||
for i, node in enumerate(toc_nodes):
|
||||
lines.append('\xa0\xa0' * i + '➤ ' + (node.get('title') or _('Unknown')))
|
||||
tt = ngettext('Table of Contents section:', 'Table of Contents sections:', len(lines))
|
||||
tt += '\n' + '\n'.join(lines)
|
||||
section.setToolTip(0, tt)
|
||||
self.section_map[section_key] = section
|
||||
self.addTopLevelItem(section)
|
||||
section.setExpanded(True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue