获取QLabel文本的像素长度

width = label.fontMetrics().boundingRect(label.text()).width();

 

原文地址:https://www.cnblogs.com/tingtaishou/p/14631187.html