Insert html style in Qt

Introduce html adjustment style in Qt

HTML

  • Set line spacing font height and color
<html><head/><body><p style=\"height:16px;line-height:24px;color:#787878\"> helloWorld</p></body></html>

Skill

  • Realize dynamic underline of Html link
    • Inherit QLabel and rewrite the entry and exit event (control the text-decoration: none; attribute in the Html text link). The underline can be displayed when the mouse stays, and the underline is hidden when the mouse leaves.
    void MyStyleLink::enterEvent(QEvent *eve)
    {
        setText(text().replace("none", "underline"));
    }
    void MyStyleLink::leaveEvent(QEvent *eve)
    {
        setText(text().replace("underline", "none"));
    }

The benefits of this article, free to receive Qt development learning materials package, technical video, including (C++ language foundation, C++ design pattern, introduction to Qt programming, QT signal and slot mechanism, QT interface development-image drawing, QT network, QT database programming, QT project actual combat, QSS, OpenCV, Quick module, interview questions, etc.) ↓↓↓↓↓↓See below↓↓Click on the bottom of the article to receive the fee↓↓

Guess you like

Origin blog.csdn.net/m0_60259116/article/details/130031953