[PyQt] Semi-transparent QDrag pixmap

Jugdish jugdizh at gmail.com
Wed Sep 30 18:36:10 BST 2009


Is there any way to make the pixmap on a QDrag object be semi-transparent?

Here is the code I've got right now:

################################################

def startDrag(self, supportedActions):
    drag = QDrag(self)

    pixmap = QPixmap("/path/to/my/image.png")
    alphaChannel = QPixmap(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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090930/ae77e4f0/attachment.html


More information about the PyQt mailing list