[PyQt] setCursor does not seem to work as expected in graphicsScene/View
list at qtrac.plus.com
Wed Aug 25 11:41:07 BST 2010
On Wed, 25 Aug 2010 10:54:49 +0200
"Christopher M. Nahler" <christopher.nahler at papermodels.at> wrote:
> I'll take it as an "if all else fails" solution :-) not giving hope
> up now!
Good for you:-)
> I have changed the item cursors and view cursors to be differnt to
> see which one wins as sometimes it looked as if it was working. But
> it turns out its the item cursors that wins.
I would expect items to win over the view since they are logically on
top of the view.
> After reading more on cursors I have found that application override
> cursor works with a stack. Is this also the case with the "normal"
> item cursors? Do I need to unset cursors? I see a reference to a
> unsetCursor() function but cannot find details to it.
The application cursor does use a stack.
For QWidgets & QGraphicsItems a call to unsetCursor() means "I don't
have a cursor preference so use my parent's cursor over me".
> On 25.08.2010 10:30, Mark Summerfield wrote:
> > 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.
> > [snip]
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Advanced Qt Programming" - ISBN 0321635906
More information about the PyQt