PDA

View Full Version : how to set the transparent of a bitmap to a cursor



xiongxiongchuan
28th August 2010, 09:17
hi ,i want to creat a custorm cursor from a bmp file, i used the code as below ,anyone can help me?
QBitmap pic(":/MainForm/images/CrossCursor.bmp",0);
pic.createMaskFromColor(QColor(Qt::red),Qt::MaskOu tColor);

QCursor curs(pic,-1,-1);


this->setCursor(curs);

xiongxiongchuan
29th August 2010, 01:29
is there anyone can help me?:o

saa7_go
29th August 2010, 06:15
This is how i do it


QPixmap pix(":/cur.bmp");
pix.setMask(QBitmap(QPixmap(":/mask.bmp")));
setCursor(QCursor(pix));