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

Mark Summerfield list at qtrac.plus.com
Wed Aug 25 09:30:51 BST 2010

On Wed, 25 Aug 2010 10:16:08 +0200
"Christopher M. Nahler" <christopher.nahler at papermodels.at> wrote:
> I have done more tests and found the following:
> - I have tried self.update() in various locations of updateItems()
> and it did not change the behaviour.
> - The changing of cursors always work with the item though.
> - I have also tried commenting the item.update() line and this does
> not change the behaviour so I think update() is not relevant to
> cursor changes.
> - I tried it with commenting the loop at the end where i change the
> item cursors and that changed the behaviour. So somehow changing the
> cursor of an item has an effect on the view.
> Any ideas or tips? Is this a bug or am I doing something the wrong
> way? If I cannot get the cursors to work right I need to change my
> approach on how i tell the user which mode he is working in.

One simple "cheat" is to create a QGraphicsItem that is the same size as
the scene and give it a big negative zValue so that it is always at the
back and to change the icon on that item... Haven't tried this though.


Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Rapid GUI Programming with Python and Qt" - ISBN 0132354187

More information about the PyQt mailing list