The QCursor
class provides methods get and set a QPixmap
or a QBitmap
on the cursor. I can create a cursor from one of the standard shapes, e.g. Qt::ArrowCursor
. However, if I do so, I cannot get the pixmap/bitmap of the cursor!
QCursor cursor(Qt::ArrowCursor);
qDebug() << cursor.pixmap().isNull()
<< cursor.bitmap()
<< cursor.mask();
Will generate the output
true 0x00 0x00
I know the documentation says it's not possible, but I need to get the pixmap/icon/image/animation/whatever of a specific cursor.
So, is there a way to get the icon of a standard cursor from Qt? I'm wondering because if you drag an item from a QListView
, it will show both, the standard cursor an the image of whatever I am dragging!
Plain and simple, you can't.
QPixmap QCursor::pixmap() const
Returns the cursor pixmap. This is only valid if the cursor is a pixmap cursor.
The reason is that for builtin cursors Qt just asks the operating system to use that particular shape by means of symbolic constants, without ever accessing the actual pixmap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With