Qt QPainter中获取字体的像素高度和宽度

来源:互联网 发布:苹果mac偏好设置在哪 编辑:程序博客网 时间:2024/06/05 06:09

QPianter painter(this);
QFontMetrics fm = painter.fontMetrics();
int width = fm.width(text);//获得一个字符串的宽度
int height = fm.descent()+fm.ascent();//获得字符的高度

0 0
原创粉丝点击