Draw rich text with QPainter

前端 未结 2 1520
独厮守ぢ
独厮守ぢ 2020-12-09 10:00

is there a way to draw fixed text that has subscripts. My goal is to have something like: \"K_max=K_2 . 3\"

QString equation=\"K_max=K_2 . 3\";
painter.drawT         


        
2条回答
  •  时光说笑
    2020-12-09 10:54

    You may use supported Qt HTML subset to format your text. If you need to draw formatted text, you should use QTextDocument::drawContents.

    QPainter::drawText is designed for plain text without formatting, and it works much faster.

提交回复
热议问题