def slotLinkHelpRequested(self, pos, page, link): """Called when a ToolTip wants to appear above the hovered link.""" if isinstance(link, popplerqt5.Poppler.LinkBrowse): cursor = self._links.cursor(link) if cursor: import documenttooltip text = documenttooltip.text(cursor) elif link.url(): l = textedit.link(link.url()) if l: text = "{0} ({1}:{2})".format(os.path.basename(l.filename), l.line, l.column) else: text = link.url() QToolTip.showText(pos, text, self.view.surface(), page.linkRect(link.linkArea()))
def slotLinkHelpRequested(self, ev, page, link): """Called when a ToolTip wants to appear above the hovered link.""" pos = self.view.viewport().mapToGlobal(ev.pos()) if link.url: cursor = self._links.cursor(link) if cursor: import documenttooltip text = documenttooltip.text(cursor) else: l = textedit.link(link.url) if l: text = "{0} ({1}:{2})".format(os.path.basename(l.filename), l.line, l.column) else: text = link.url elif hasattr(link, "linkobj") and isinstance(link.linkobj, popplerqt5.Poppler.LinkGoto): text = _("Page {num}").format(num=link.linkobj.destination().pageNumber()) if link.linkobj.isExternal(): text = link.linkobj.fileName() + "\n" + text else: return QToolTip.showText(pos, text, self.view, page.linkRect(link))