[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdebase/workspace/libs/plasma/widgets
From:       David Faure <faure () kde ! org>
Date:       2007-10-17 23:27:44
Message-ID: 200710180127.44574.faure () kde ! org
[Download RAW message or body]

On Tuesday 16 October 2007, Ho ng Đức Hiếu wrote:
> On 10/16/07, David Faure <faure@kde.org> wrote:
> > On Tuesday 16 October 2007, Ho ng Đức Hiếu wrote:
> > > SVN commit 725859 by hdhoang:
> > > -    return m.boundingRect(d->text).size();
> > > +    return m.boundingRect(QRectF(0,0,9999,9999), d->alignment | Qt::TextWordWrap, d->text).size();
> >
> > How can it ever word-wrap in such a wide rectangle? I don't get the point of this.
> >
> 
> I spotted this in my fortune-teller plasmoid. My use case was putting
> /usr/games/fortune's stdout on a label, fortune's output is linebroken
> at 80 characters. The label has width proportional to the fortune's
> length, I have seen up to 5000px width. And the height is always 3
> lines, regardless of the text's length.
> 
> So, in the above line, the main fix was using the flags, and only this
> boundingRect accepts them. 
Well, yes. Qt can't guess what the width should be if we don't tell it.

I guess you want a "determine a good looking width" kind of method,
but I can't think of one right now.

> I had to use some QRectF, and this huge 
> QRectF won't create size limit.
But then you don't get any wordwrap, or am I missing something?

> And I have discovered that that would still produce wide labels for
> wide output (e.g. catting this mail). Maybe I should find out the
> corona's size and use it for the QRectF?
That would already make more sense than 9999, I guess.

> The plasmoid is at playground/base/plasma/applets/fortune-teller, and
> it uses playground/base/plasma/engines/executable, and a
> "/usr/games/fortune" executable.

I'm afraid I don't have time for debugging this myself, but I know for sure that
asking for word wrap with a very large width makes little sense.

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic