[PyQt] Bug in QRectF

David Lassonde David.Lassonde at autodesk.com
Fri Jul 24 14:47:21 BST 2009


Yes. The goal here is to join two bounding boxes so the resulting bounding box is the union of the two rectangles.

as documented in the Qt reference (http://doc.trolltech.com/4.5/qrect.html#operator-7c):

	QRect QRect::operator| ( const QRect & rectangle ) const
	Returns the bounding rectangle of this rectangle and the given rectangle.

	See also operator|=() and united().

	QRect & QRect::operator|= ( const QRect & rectangle )
	Unites this rectangle with the given rectangle.


The rectangles I am using are limit cases. Here are some results with trivial rectangles (good results)

from PyQt4.QtCore import QRectF
goodRect = QRectF(0,0,1,3000) | QRectF(0,0,0,16)
#	(0.0, 0.0, 1.0, 3000.0)


from PyQt4.QtCore import QRectF
goodRect = QRectF(0,0,1,3000) | QRectF(0,0,0,16)
#	(4.0, 5.0, 11.0, 11.0)



-----Original Message-----
From: pyqt-bounces at riverbankcomputing.com [mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of Henrik Pauli
Sent: Friday, July 24, 2009 9:34 AM
To: pyqt at riverbankcomputing.com
Subject: Re: [PyQt] Bug in QRectF

On Friday 24 July 2009 15:16:38 David Lassonde wrote:
> Hi all,
>
> the following does not work in PyQt 4.5.2:
>
> from PyQt4.QtCore import QRectF
> wrongRect = QRectF(0,0,0,3000) | QRectF(0,0,0,16)

Are you sure you mean the bitwise or here? :)

>
> The expected result is (0,0,0,3000) but I get (0,0,0,16).
>
> it used to work in PyQt 4.4.3
>
> As a workaround, I am now using my own "or" function.
>
> I thought you might be interested in the information.
>
> Cheers,
>
> David
_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt



More information about the PyQt mailing list