Using the Qt framework, how do I measure the width (in pixels) of a piece of text rendered with a given font/style?
In the paintEvent
QString text("text"); QFontMetrics fm = painter.fontMetrics(); int width = fm.width(text);