Getting a QIcon from a QCursor
-
I have a QCursor and I'm trying to get a QIcon from it.
const auto cursorShape = Qt::CursorShape::ArrowCursor; QCursor cursor(cursorShape); const QPixmap pixmap = cursor.pixmap(); QIcon qIcon(pixmap);
After that, the qIcon seems to contain null and when I try to use it, I don't get an icon.
Any suggestions?
Thanks
-
I have a QCursor and I'm trying to get a QIcon from it.
const auto cursorShape = Qt::CursorShape::ArrowCursor; QCursor cursor(cursorShape); const QPixmap pixmap = cursor.pixmap(); QIcon qIcon(pixmap);
After that, the qIcon seems to contain null and when I try to use it, I don't get an icon.
Any suggestions?
Thanks
where and how do you use it?
Mind the object lifetime -
Hi,
From the documentation:
This is only valid if the cursor is a pixmap cursor.
which is not the case here.