Qt 中获取字体的像素高度和宽度-CSDN博客

网站介绍:文章浏览阅读3.1w次。最近在用Qt做文字的滚屏效果,要计算字体的像素高度和像素宽度,用到以下几个函数: 1. QLabel::fontMetrics().width(QString s): 获取字符串s的总像素宽度。int QFontMetrics::width ( const QString & text, int len = -1 ) constReturns the width in pixels of the first len characters of te