Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, April 2007
fontmetrics


Message 1 in thread

Hi,
i have

QFontMetrics fontMetrics(font);

size = fontMetrics.width("-");

but size = 0; 

why?
                      Nicola

--
 [ signature omitted ] 

Message 2 in thread

Hi,
if i have

QFontMetrics fontMetrics(font);

 size = fontMetrics.width("-");

size = 5; (ok for my font)

but if i have

size = fontMetrics.width("-4");

size = 8; (wrong, 8 is only 4 size)

 why?
                       Nicola

--
 [ signature omitted ] 

Message 3 in thread

On 4/8/07, Nicola De Filippo <nicola@xxxxxxxxxxxxxxxxxx> wrote:
> Hi,
> if i have
>
> QFontMetrics fontMetrics(font);
>
>  size = fontMetrics.width("-");
>
> size = 5; (ok for my font)
>
> but if i have
>
> size = fontMetrics.width("-4");
>
> size = 8; (wrong, 8 is only 4 size)
>
>  why?

I get 4 and 11. What font are you using, what version of Qt are you
using, and what system are you running on?

-- 
 [ signature omitted ] 

Message 4 in thread

Hi,

> > if i have
> >
> > QFontMetrics fontMetrics(font);
> >
> >  size = fontMetrics.width("-");
> >
> > size = 5; (ok for my font)
> >
> > but if i have
> >
> > size = fontMetrics.width("-4");
> >
> > size = 8; (wrong, 8 is only 4 size)
> >
> >  why?
>
> I get 4 and 11. What font are you using, what version of Qt are you
> using, and what system are you running on?

I use Qt 4.2.2 on kubuntu 6.10
                      N.

--
 [ signature omitted ] 

Message 5 in thread

Nicola De Filippo wrote:

>> I get 4 and 11. What font are you using, what version of Qt are you
>> using, and what system are you running on?
> 
> I use Qt 4.2.2 on kubuntu 6.10

And the font?

--
 [ signature omitted ] 

Message 6 in thread

Where did you get the font from? It must be properly set up. I'm doing the
same thing in several places in my code, and it works fine.

Keith


On 04-08-2007 4:06 PM, "Nicola De Filippo" wrote:

> Hi,
> i have
> 
> QFontMetrics fontMetrics(font);
> 
> size = fontMetrics.width("-");
> 
> but size = 0; 
> 
> why?
>                       Nicola


--
 [ signature omitted ] 

Message 7 in thread

Hi,

> QFontMetrics fontMetrics(font);

Show us how font is initialized.

A complete, minimal, compilable example would help.

--
 [ signature omitted ]