JasonGenX
JasonGenX

Reputation: 5444

Qt: Font size or rather height

I have a fixed strip I'm drawing, 50 pixels in height and as wide as my application main window.

I'd like to place text on that strip.

My problem is that even with the same font and size (arial 15 for example), the font will have a different height under OSX and Windows.

Is there a way to make this more predictable? I know I can use the QFont measuring mechanism until the extent of the text I need will match my target projection area, more or less. but is there another way to set size that'll be identical across operating systems? Just want to make sure I'm not missing something here.

Upvotes: 3

Views: 2552

Answers (1)

Arnold Spence
Arnold Spence

Reputation: 22292

You can specify font heights in pixels using QFont::setPixelSize(). It's particularly handy when drawing text over fixed sized bitmaps.

Upvotes: 2

Related Questions