农历和公历显示可以用富文本进行处理,上下显示,自定义字体和颜色。
void DayLabel::showDay(int nDay, QString strLunar)
{
QString strText = "";
strText += "<html><head/><body><p><span style=\" font-size:16px; \">";
strText += QString::number(nDay);
this->m_nDay = nDay;
if ("" != strLunar) {
strText.append("</span><br>");
strText.append("<span style=\" font-size:12px; color:#ffffff;\">");
strText.append(strLunar);
strText.append("</span></p></body></html>");
}
this->setText(strText);
}