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

Mark Summerfield list at qtrac.plus.com
Tue Aug 24 15:03:20 BST 2010


Hi Christopher,

I think one factor is that you call update() on the items after changing
the cursor, but not on the view. I tried this:

     def updateItems(self):
         print("view updateItems")
         m = self.scene().viewMode()

         if m == MyScene.SELECTMODE:
             print("is select mode")
             itemCursor = Qt.OpenHandCursor

         elif m == MyScene.EDITMODE:
             print("is edit mode")
             itemCursor = Qt.ForbiddenCursor

         elif m == MyScene.DRAWMODE:
             print("is draw mode")
             itemCursor = Qt.CrossCursor

         items = self.scene().items()

         for item in items:
             item.setCursor(itemCursor)
             item.update()
         self.setCursor(itemCursor)
         self.update()

which had an interesting effect, i.e., the view's cursor does change,
but it doesn't work as I expected, and I don't have time to look into it
further:-(

[snip]

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Advanced Qt Programming" - ISBN 0321635906
            http://www.qtrac.eu/aqpbook.html


More information about the PyQt mailing list