需要设置error的样式
设置样式
color:rgb(255, 0, 0);
font-size:12pt;
font-family:Microsoft YaHei;
字体、颜色也可通过富文本设置在程序中设置
emit LoginError(QStringLiteral("<font style='font-size:12px; color:red;'>用户名、密码错误!</font>"));
例如:
实现方法:
ui.mSizeLabel->setText(QStringLiteral("< font style='color:black; font-weight:normal;'>已保存 </font>")
+ "< font style = 'color:#5B8FF9; font-weight:bold;'>"+QString::number(_currSize)
+ "< / font > "+ QStringLiteral("< font style='color:black; font-weight:normal;'> 张</font>" ));
设置文字居中,使用qt的Designer,设置水平垂直居中