//设置显示内容
void PicWidget::SetText(QString strA, QString strB, bool bRight)
{
QFont myfont ("Monospace");
myfont.setBold(true);
if(bRight)
{
myfont.setPixelSize(30);
strA = "<font color=blue>" + strA + "</font>";
}
else
{
myfont.setPixelSize(20);
strA = "<font color=red>" + strA + "</font>";
}
m_text->setFont(myfont);
m_text->setText(strA);
if(strB != "")
{
strB = "<font color=black>" + strB + "</font>";// 设置文字(样式+内容)
m_text->append(strB);
}
}
QT设置多行显示字体颜色
最新推荐文章于 2024-04-27 21:41:15 发布