QString

格式化字符串

strMetTime = QString("%1: %2, %3").arg(metName).arg(strAltitude).arg(strTotalM);

QString labelSSR = QString("%1").arg(SSR, 4, 10, QChar('0'));

QString customFormatString = dateTime.toString("yyyy-MM-dd HH:mm:ss");

time = QDateTime::fromString(dateContent, "yyyy-MM-dd hh:mm:ss");

 

获取某种字体尺寸:

QFont theFont("宋体", 11);

QFontMetrics fm(theFont);

int width=fm.width();

int fontSize = fm.height();

QRect rect = metrics.boundingRect("明月出天山");

posted on 2025-08-31 05:58  万里驰骋  阅读(8)  评论(0)    收藏  举报

导航