Skip to main content

Posts

Showing posts from June, 2010

QPixmap::setAlphaChannel artifacts

  I found strange artifact connected with alpha channel in QPixmap. In my project Owely, I use few layers to separate different tools interactions, so you just repaint some level without worries. So all levels had alpha channels set on constructor, but strange stuff appear, on the second initialization they wasn't empty, they was filled with previous screenshot with transparency, check the image The problem was solved by this article: http://labs.trolltech.com/blogs/2009/12/16/qt-graphics-and-performance-an-overview/ there was words about setAlphaChannel that works unstable, and should be used with fill() method m_pixmap = QPixmap(parent->width(), parent->height()); m_pixmap.setAlphaChannel(m_pixmap); m_pixmap.fill(Qt::transparent); // this fix the deal I don't advise to use fill on paint event, or somewhere in the loop.