Qt-interest Archive, May 2008
Bug using QWidget::setMask(QBitmap)
Message 1 in thread
Qt Developers,
When running the following code on a Mac OS X 10.5 with Qt 4.4
QWidget *myWidget;
// some widget setup
QColor qmask(RED_VALUE, GREEN_VALUE, BLUE_VALUE); // Some weird green value
QImage image(MY_PNG_MASK_IMAGE); // A image with weird
green valued pixels that were meant to be transparent
QBitmap bmp =3D =
QBitmap::fromImage(image.createMaskFromColor(qmask.rgba(), Qt::MaskInColor);
myWidget->setMask(bmp);
I'm getting a weird output. The mask image has some unused border, about 15
pixels wide (which has the mask color), that is wipped off the mask QBitmap,
something like: the bitmap is translated so the pixel (0, 0) is the first
'meaningfull' pixel. By meaningfull I mean the first pixel whose collumn or
row (from 0 to width/height) has a pixel different from the mask color. I
could solve the problem by cutting the (by now) meaningless border from the
mask image and translating the children QWidgets by a few pixels (I'm using
no layout, just absolute position inside the parent QWidget). I think this
is a bug because the code worked fine with Qt 4.3.4.
Best regards,
--
[ signature omitted ]