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

List:       koffice-devel
Subject:    Re: KoRect::clear()
From:       Werner Trobin <trobin () kde ! org>
Date:       2002-04-28 10:08:12
[Download RAW message or body]

On Sunday 28 April 2002 11:53, David Faure wrote:
> On Sunday 28 April 2002 10:47, Lenny wrote:
> > > // clear out
> > > r = KoRect();
> >
> > Thought about that too. I dont like that much, but will have to go this
> > way then.
>
> Let's keep consistent with the QRect API. AFAIK this is the only way with
> QRect.
>
> > > BTW, could it be that KoRect::isNull() is broken in the sense that
> > > it does not return true for a KoRect object created with the default
> > > constructor?
>
> Whoops. Fixed, thanks.
>
> > Yes. QRect test this way: return x2 == x1-1 && y2 == y1-1;
>
> QRect has this "one pixel difference" stuff that KoRect obviously doesn't
> have.

Not that I know the code, but maybe you could use DBL_MIN from float.h.
Just initialize the width/height with -DBL_MIN to get "the next negative real 
number after 0.0" ;-)

As this is a constant the compiler defines it's representable and you can 
easily test with a plain operator==(). It's also unlikely that you'll have 
lots of other "valid" rectangles with that size.

Ciao,
Werner
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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