[PyQt] Unable to use qt_graphicsItem_highlightSelected and qFuzzyCompare(float, float)

Phil Thompson phil at riverbankcomputing.com
Wed Nov 10 17:17:11 GMT 2010


On Wed, 10 Nov 2010 17:05:54 +0200, Ahmet Emre Aladağ
<aladagemre at gmail.com> wrote:
> Hi,
> 
> I'm trying to use qt_graphicsItem_highlightSelected static function in
> PyQt4
> but I'm unable to do so. It seems like there's no binding to it. Does
> anyone
> know how to use it to produce selection box around QGraphicsItem? Here
it
> is
> mentioned how to do it in C++ but I could not use it with PyQt4:
>
http://www.qtforum.org/post/109281/custom-qgraphicsitem-doesn-t-get-dotted-selection-rectangle.html#post109281

It isn't part of the Qt API.

> Then I tried to re-implement it in Python from
>
http://websvn.kde.org/branches/qt/4.4/src/gui/graphicsview/qgraphicsitem.cpp?view=markup.
> But I face a parameter conflict for qFuzzyCompare. I should be able to
use
> it like this:
> 
> qFuzzyCompare(float, float) but I can't:
> 
>     if qFuzzyCompare(self.qMax(murect.width(), murect.height()) + 1, 1):
> TypeError: arguments did not match any overloaded call:
>   qFuzzyCompare(QMatrix, QMatrix): argument 1 has unexpected type
'float'
>   qFuzzyCompare(QMatrix4x4, QMatrix4x4): argument 1 has unexpected type
> 'float'
>   qFuzzyCompare(QQuaternion, QQuaternion): argument 1 has unexpected
type
> 'float'
>   qFuzzyCompare(QTransform, QTransform): argument 1 has unexpected type
> 'float'
>   qFuzzyCompare(QVector2D, QVector2D): argument 1 has unexpected type
> 'float'
>   qFuzzyCompare(QVector3D, QVector3D): argument 1 has unexpected type
> 'float'
>   qFuzzyCompare(QVector4D, QVector4D): argument 1 has unexpected type
> 'float'
> 
> Any ideas?

Use the qFuzzyCompare() from QtCore rather than QtGui.

Phil


More information about the PyQt mailing list