I'm trying to setup a custom QCursor
in PySide, but there are no usable code samples on it. As I understand, there's pixmap, and the pixmap's mask, which is set with QPixmap.setMask()
.
I'm doing both:
open_hand_px = QtGui.QPixmap('open_hand.png')
open_hand_px.setMask(open_hand_px.mask())
open_hand_cursor = QtGui.QCursor(pixmap=open_hand_px)
self.setCursor(open_hand_cursor)
The image I'm using is loading fine, there are no errors, but the cursor refuses to change. I don't know what I'm doing wrong.
Thanks for your replies!
From the docs:
About keyword arguments
Only optional arguments can be used as keyword arguments.
So, remove pixmap=
:
open_hand_px = QtGui.QPixmap('open_hand.png')
open_hand_px.setMask(open_hand_px.mask())
open_hand_cursor = QtGui.QCursor(open_hand_px)
self.setCursor(open_hand_cursor)