Show note dialog: Fix links not being activated when clicked

This commit is contained in:
Kovid Goyal 2023-11-03 20:49:44 +05:30
parent 31611e434a
commit f4db41bf82
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -24,6 +24,10 @@ class Display(HTMLDisplay):
super().__init__(parent) super().__init__(parent)
self.document().setDefaultStyleSheet(resolved_css() + '\n\nli { margin-top: 0.5ex; margin-bottom: 0.5ex; }') self.document().setDefaultStyleSheet(resolved_css() + '\n\nli { margin-top: 0.5ex; margin-bottom: 0.5ex; }')
self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.setFocusPolicy(Qt.FocusPolicy.NoFocus)
self.anchor_clicked.connect(self.handle_link_click)
def handle_link_click(self, qurl):
safe_open_url(qurl)
def loadResource(self, rtype, qurl): def loadResource(self, rtype, qurl):
if qurl.scheme() == RESOURCE_URL_SCHEME and int(rtype) == int(QTextDocument.ResourceType.ImageResource): if qurl.scheme() == RESOURCE_URL_SCHEME and int(rtype) == int(QTextDocument.ResourceType.ImageResource):