[Issue N108897] Dangerous, subtle change to QRect::normalize()

qt-bugs at trolltech.com qt-bugs at trolltech.com
Fri Mar 31 11:50:39 BST 2006


Hi Clarence,

On Friday, 31. mar 2006 20:51 Clarence Dang wrote:

> [CC'ing kde-core-devel as anyone porting code to Qt4 might want to
> know]
>
> On Friday 31 March 2006 00:06, qt-bugs at trolltech.com wrote:
> > On Thursday, 30. Mar 2006 18:34 Clarence Dang wrote:
> > > [Maybe a duplicate of
> > >
> > >
http://www.trolltech.com/developer/tasktracker.html?method=entry&id=80908
> > > but it's still not fixed and also "Q_ASSERT(!normRect.isValid());"
> > > should not have the "!" to have been a valid bug report]
>
> So N80908 is unrelated?

It is related, granted the code snippet is dubious and the code you
refer to was introduced as a result of fixing 80908, which was fixed
for Qt 4.1.0.

[snip]

> > We are aware of some special cases with QRect not working the way
> > that they should be but unfortunately these cannot be changed for a
> > maintanence release. However, we are looking into accomodating these
> > cases for the Qt 4.2 and documenting the ones that cannot be
> > resolved directly.
>
> The example above is not a contrived one:
>
> http://websvn.kde.org/trunk/KDE/kdegraphics/kolourpaint/tools/kptoolpen.cpp:
>     QRect rect = QRect (thisPoint, lastPoint).normalize ()
>
> This innocent looking line will work for all values of "thisPoint" and
> "lastPoint", _except_ for 4 special cases by my count:
>
> ++
> +*
> +
>
> Where "*" is the topLeft point and "+" are the troublesome bottomRight
> points.
>
> This is very unexpected!

I can understand that, but we cannot change this for Qt 4.1.3, the
behaviour was changed for a minor release and since we are on Qt 4.1.2,
we cannot justify a change of behaviour which people may be relying on.
I have spoken to the developers already about this and we are looking
at ensuring that QRect is correct in all aspects for Qt 4.2, but we
can't do anything about this case before then except document it.

Regards,
Andy
--
Andy Shaw - Senior Support Engineer
Trolltech AS, Oslo - http://www.trolltech.com





More information about the kde-core-devel mailing list