PDA

View Full Version : How to transparent QIconView



wesley
8th April 2009, 04:23
Hello, everybody here..

I have a critical problem.
I want to make the background of QIconView transparent.
I had tried some things below, but all of them doesn't work!!!
1. set background origin, this works for QLabel , etc, but not for QIconView


setBackgroundOrigin(QWidget::ParentOrigin);
viewport()->setBackgroundOrigin(QWidget::ParentOrigin);

2. set backgroundMode, but get i background fill with black, not i want


viewport()->setBackgroundMode(Qt::NoBackground)
setBackgroundMode(Qt::NoBackground);

3. use setMask, causes some X errors ? I don't know what it is. it seems critical.


void MyIconView::updateMask()
{
QBitmap bm( size() );
bm.fill( color0 );

QRect cr = contentsRect();
QPainter paint;
paint.begin( &bm, this );
paint.setBrush( color1 );
paint.setPen( color1 );

drawContents(&paint, cr.x(), cr.y(), cr.width(), cr.heigth()); // this cause some X error (invalid match.....some thing like this ... QT debug many things )

paint.end();
setMask( bm );
}



I can not find out a way to go through this function.
Any idea?

Thanks ...

/WX

wysota
8th April 2009, 08:07
Are we talking about Qt3 here?