[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: What's the size in pixels of a QString with a given QFont?
From: Steffen Hansen <stefh () mip ! sdu ! dk>
Date: 1999-07-29 8:57:27
[Download RAW message or body]
On Wed, 28 Jul 1999, Arvid Nilsson wrote:
> Hi there!
>
> How can I find out the size in pixels (width, height) of a QString painted
> using a given QFont? Currently I put the QString in a QLabel and get its
> sizeHint().
Now that's an alternative way ;-)
The right way is to construct a QFontMetrics object with the font you want
to use:
QFontMetrics fm( someFont);
int w = fm.width( "Blabla");
int h = fm.height();
greetings,
--
Steffen Hansen
email: stefh@mip.sdu.dk, stefh@imada.sdu.dk, hansen@kde.org
URL: http://www.mip.sdu.dk/~stefh
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic