[Qt-interest] background pixmap of a QFrame

Ramakrishnan Muthukrishnan vu3rdd at gmail.com
Wed Apr 22 06:55:21 CEST 2009


Hi,

I am new to Qt and also have never done GUI programs before, but have
been enjoying my journey so far.

I had been modifying some Qt3 programs to work with Qt4. I had a piece
of code like this in Qt3:

    ctlFrame = new QFrame (this);

    QPixmap *a_pix = new QPixmap( a_xpm );
    sFrame = new QFrame( ctlFrame );
    sFrame->setPaletteBackgroundPixmap( *a_pix );

I modified this for Qt4 as

    spalette.setBrush(QPalette::Background, QBrush(a_pix));
    sFrame->setPalette(spalette);

as specified in the Qt4 porting document and the Qt3 support classes
reference. But I don't see the background pixmap at all. I am able to
setPixmap over labels. But backgroundpixmaps for QFrames do not seem
to show up. What could be the reason?

Thanks
-- 
  Ramakrishnan



More information about the Qt-interest-old mailing list