[PyQt] setCursor does not seem to work as expected in graphicsScene/View

Baz Walter bazwal at ftml.net
Thu Aug 26 17:56:47 BST 2010


On 26/08/10 08:45, Christopher M. Nahler wrote:
> Thank you Baz! You pointed me to the solution of my problem ... and it
> was easier than your solution :-)

you're welcome :)

> I did not know of *self.viewport()* in the view class.
>
> Updating the cursor of the view with self.viewport().setCursor() instead
> of just self.setCursor() did the trick.

are you sure?

following your suggestion, i updated your original test case by 
replacing "self.setCursor" with "self.viewport().setCursor" in the 
"updateItems" method.

now if F3 is pressed whilst the cursor is over a rectangle it will 
change to a cross shape. then, with the cursor *still over the 
rectangle*, if F1 is pressed the cursor changes to a hand. but now move 
the cursor outside of the rectangle, and instead of changing to an 
arrow, it will change back to a cross!

can you confirm this?

if not, things must work differently on windows (i'm on linux).


More information about the PyQt mailing list