<p>Hi. Thanks for your reply. What you have to do in SIP, is it of the nature of a workaround to Python's inability to do the conversion automatically? Or Python is able to do the conversion automatically and SIP just needs to present the classes in a proper manner as required by Python?</p>

<p>Sent from my Android phone</p>
<div class="gmail_quote">On Sep 20, 2012 2:19 PM, "Phil Thompson" <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, 20 Sep 2012 07:34:10 +0530, Shriramana Sharma <<a href="mailto:samjnaa@gmail.com">samjnaa@gmail.com</a>><br>
wrote:<br>
> In my recent work with Beziers I ran across this. A QPoint is *not*<br>
> automatically converted into a QPointF in Python/PyQt while it *is*<br>
> converted in C++:<br>
><br>
> The following C++ code compiles fine:<br>
><br>
> # include <QtCore/QPoint><br>
> # include <QtGui/QPainterPath><br>
> int main ( void ) {<br>
>       QPainterPath p ;<br>
>       QPoint p1 ( 100, 150 ), c1 ( 166, 250 ), c2 ( 234, 250 ), p2 ( 300, 150<br>
)<br>
>       ;<br>
>       p . moveTo ( p1 ) ;<br>
>       p . cubicTo ( c1, c2, p2 ) ;<br>
> }<br>
><br>
> whereas its Python/PyQt equivalent:<br>
><br>
> #! /usr/bin/env python3<br>
> from PyQt4 . QtCore import QPoint<br>
> from PyQt4 . QtGui import QPainterPath<br>
> p = QPainterPath ()<br>
> p1 = QPoint ( 100, 150 )<br>
> c1 = QPoint ( 166, 250 )<br>
> c2 = QPoint ( 234, 250 )<br>
> p2 = QPoint ( 300, 150 )<br>
> p . moveTo ( p1 )<br>
> p . cubicTo ( c1, c2, p2 )<br>
><br>
> produces the following:<br>
><br>
> Traceback (most recent call last):<br>
>   File "./qpoint-test.py", line 11, in <module><br>
>     p . moveTo ( p1 )<br>
> TypeError: arguments did not match any overloaded call:<br>
>   QPainterPath.moveTo(QPointF): argument 1 has unexpected type 'QPoint'<br>
>   QPainterPath.moveTo(float, float): argument 1 has unexpected type<br>
>   'QPoint'<br>
><br>
> But QPointF in PyQt *does* provide a constructor from QPoint, so is<br>
> this the limitation of Python that it does not automatically check<br>
> whether it can convert one type to another to satisfy a function's<br>
> call signature? (Or is there some other fault in my PyQt code?)<br>
><br>
> I realize I could always convert it manually using QPointF(p1) etc but<br>
> the assumption seems natural that an integer-precision numeric object<br>
> should be accepted where a float-precision can...<br>
<br>
It requires a change to SIP to handle this automatically which is on the<br>
TODO list but I haven't got round to it yet.<br>
<br>
Phil<br>
</blockquote></div>