PDA

View Full Version : QT4 version for QT3 setBackgroundMode( NoBackground )



jiveaxe
31st May 2008, 15:57
Hi,
I'm trying to add an "on screen display" object to my application like amarok's osd. So reading Amarok 1.4.9 source code I have found the code in the object in the class OSDWidget of the files osd.h/osd.cpp. Here a sample:


class OSDWidget : public QWidget
{
Q_OBJECT

OSDWidget( QWidget *parent, const char *name = "osd" );
...
};

OSDWidget::OSDWidget( QWidget *parent, const char *name )
: QWidget( parent, name)
{
...
setBackgroundMode( NoBackground );
...
}

How port that line in qt4? Perhaps the solution is QWidget::setBackgroundRole but there isn't a Qt::NoBackground.

Or anybody knows a simple code?

Thanks

jacek
3rd June 2008, 23:20
NoBackground != transparency. It just means that Qt doesn't draw the default background before calling paintEvent(). In Qt 4 you can achieve the same by setting WA_OpaquePaintEvent attribute.

jiveaxe
4th June 2008, 13:26
Very thanks, jacek.