使用浏览器打开关于页面的超链接

This commit is contained in:
shuaikangzhou 2024-01-04 21:58:20 +08:00
parent 4cfc48a9a1
commit 90037f8cb5
2 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,6 @@ about = f'''
地址<a href='{github}'>{github}</a><br> 地址<a href='{github}'>{github}</a><br>
官网<a href='{website}'>{website}</a><br> 官网<a href='{website}'>{website}</a><br>
新特性:<br>{''.join(['' + i for i in description])}<br> 新特性:<br>{''.join(['' + i for i in description])}<br>
License <a href='https://github.com/LC044/WeChatMsg/blob/master/LICENSE'>{license}</a><br> License <a href='https://github.com/LC044/WeChatMsg/blob/master/LICENSE' target='_blank'>{license}</a><br>
Copyright {copyright} Copyright {copyright}
''' '''

View File

@ -1,4 +1,4 @@
from PyQt5.QtCore import QSize from PyQt5.QtCore import QSize, QUrl
from PyQt5.QtGui import QPixmap from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QApplication, QDialog from PyQt5.QtWidgets import QApplication, QDialog
@ -26,7 +26,13 @@ class AboutDialog(QDialog, Ui_Dialog):
self.label_weixin.setPixmap(pixmap) self.label_weixin.setPixmap(pixmap)
self.label_version.setText('《留痕》') self.label_version.setText('《留痕》')
self.textBrowser.setHtml(config.about) self.textBrowser.setHtml(config.about)
self.textBrowser.setOpenExternalLinks(True)
self.textBrowser.anchorClicked.connect(self.handleAnchorClicked)
def handleAnchorClicked(self, url):
# 打开默认浏览器
QUrl(url).openUrl(url)
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys