[PyQt] Possible bug - global coordinates work but widget coordinates do not

Shriramana Sharma samjnaa at gmail.com
Wed Apr 8 15:56:55 BST 2009

Hello first of all let me clarify that this is specific to PyQt and does
not existing in C++/Qt.

I am using PyQt 4.3.3 on Qt 4.4.0 on Kubuntu Hardy.

I attach three files.
1. test.py is the one that demonstrates the problem.
2. test.cpp is the equivalent C++ version that shows no problem.
3. test-sol.py is the Python version that works.

I wanted to draw a rubberband on a widget, and ended up finding this
bug. Everytime the mouseMoveEvent is processed, the value of the
variable rbOrigin (origin of the rubberband) is reset to the current
event position, thereby making it impossible for a proper rubberband to
be drawn. However, it appears that the mousePressEvent (which sets the
value of rbOrigin) is definitely not called by mistake as I don't get
any debug output.

The equivalent C++ version works without problems.

Using global coordinates on Python works around the bug but I don't see why.

Please look into the matter. Thanks for PyQt.

Shriramana Sharma.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: rubberband-test.cpp
Type: text/x-c++src
Size: 931 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090408/65086d6f/rubberband-test-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rubberband-test.py
Type: text/x-python
Size: 847 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090408/65086d6f/rubberband-test-0001.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rubberband-test-sol.py
Type: text/x-python
Size: 795 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090408/65086d6f/rubberband-test-sol-0001.py

More information about the PyQt mailing list