[Qt-interest] text dimensions ?

Martin Schröer gordon at gordonswelt.de
Tue Mar 17 16:06:48 CET 2009


Yes, this is nice - but only for the 'to' direction.
What if i have a rectangle in which i want to render a text given ?
How to find out what font size to use ?


Martin

Jesús Fernández schrieb:
> Read this:
>
> http://doc.trolltech.com/4.5/qfontmetrics.html
>
> Regards
>
> On Tue, Mar 17, 2009 at 3:50 PM, Martin Schröer <gordon at gordonswelt.de 
> <mailto:gordon at gordonswelt.de>> wrote:
>
>     Hi list.
>
>     I have to drawText on a GraphicsScene.
>     Does anybody know a good practice to do this, considering the
>     [dynamic]
>     size of the text given to be drawn ?
>     I want to have the text fill a certain area in original scale, plus
>     having it resize along with the whole scene,
>     so e.g. it always fills the same region within the scene.
>
>     Like giving a text 'rate this scene 'scary'', being always shown
>     in the
>     bottom right corner of the scene
>     within a region that is scene.width() /4, scene.height() /4.
>
>     I don't have troubles getting the size of a bounding rect for doing
>     that, what gives me headaches is
>     how to find out which size the text has or has to have, still being
>     drawn in aspect when the scene
>     dimensions changes.
>
>     Any help, as always, highly appreciated.
>
>     Martin
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list