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

Clarence Dang dang at kde.org
Sun Apr 2 13:50:15 BST 2006


On Friday 31 March 2006 20:50, qt-bugs at trolltech.com wrote:
> On Friday, 31. mar 2006 20:51 Clarence Dang wrote:
> > 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.

Actually I see now: N80908 asks for the behaviour which I claim is incorrect 
(the normalized() check).  So for that purpose, its code snippet is correct.

> > 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.

Oops, should be 5 cases:
+++
+*
+

> 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.

Possible solution:

Revert QRect::normalize() to the Qt3 behaviour (no check), as it is 
QT3_SUPPORT anyway.
Keep QRect::normalize() as is with the check to retain Qt4 source 
compatibility.
Add a QRect::normalizeEx() or something to provide the Qt3 behaviour under 
Qt4.




More information about the kde-core-devel mailing list