<html><head/><body><p style=\"height:16px;line-height:24px;color:#787878\"> helloWorld</p></body></html>
技巧实现Html链接动态下划线继续QLabel并重写进入离开事宜(对Html笔墨链接中text-decoration: none;属性进行掌握). 即可实现鼠标勾留时显示下划线, 鼠标离开时隐蔽下划线.
void MyStyleLink::enterEvent(QEvent eve) { setText(text().replace("none", "underline")); } void MyStyleLink::leaveEvent(QEvent eve) { setText(text().replace("underline", "none")); }