往 table widget 里面添加控件 QTextBrowser,然后外链到邮箱。
if curr_column_name == "EMail":
text_area = QTextBrowser()
text_area.setText(u'<a href='"'mailto:jhon@compay.com'"'>jhon@compay.com</a>')
text_area.setMaximumHeight(30)
text_area.setOpenExternalLinks(True)
certain_table.setCellWidget(row_index, column_index, text_area)
参考链接如下:
how to make hyperlink to launch mail on QTextEdit in pyqt