Qt中引入html调节样式

HTML

  • 设置行间距字体高度和颜色
<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"));
    }

相关文章:

  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-12-30
  • 2022-01-13
  • 2021-09-13
猜你喜欢
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2022-02-15
  • 2022-01-06
  • 2022-01-17
  • 2021-08-27
相关资源
相似解决方案