PDA

View Full Version : Semi-transparent QDrag pixmap



Jugdish
1st October 2009, 11:10
Hi,
I'm trying to make the pixmap on a QDrag object be semi-transparent, and not having much luck. Is it possible?

Here is the code I've got right now:



void MyTreeView::startDrag(Qt::DropActions supportedActions)
{
QDrag *drag = new QDrag(this);

QPixmap pixmap("/path/to/my/image.png");
QPixmap alphaChannel(pixmap.width(), pixmap.height());
alphaChannel.fill(QColor(128,128,128));
pixmap.setAlphaChannel(alphaChannel);

drag->setPixmap(pixmap);

drag->exec(supportedActions);
}


However, setting the alpha channel on the pixmap just makes it look faded, but doesn't actually show the window contents underneath the pixmap, so it's not really transparent.