I'm simply trying to show a (nicely scaled) image as the background of some kind of container, with layout managed widgets (buttons).

This use of stylesheets works perfectly :

m_ui->my_frame->setStyleSheet("image: url(myGraphic.jpg); background-repeat: repeat;");
Unfortunately, this code won't work for me. I need to load the graphic dynamically (using QImage or QPixmap, say), not from the resource management system or the hard-drive, and I can't see how to do that with stylesheets.

Deriving a custom Frame, and writing a special also works, though it feels a lot like a hack, and causes performance issues when the Frame is re-sized. (in the code below, the custom Frame has a pixmap variable that has been pre-loaded with the graphic):

void BackgroundFrame::paintEvent(QPaintEvent *pe)
{
if(!pixmap.isNull())
{
QPainter myPainter(this);
pixmap.scaled(width(),height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
myPainter.drawPixmap(0,0, pixmap);
}
QFrame::paintEvent(pe);
}

I feel that there should be some way to do this with just a couple lines of code and/ or the simple QT designer built into QT Creator, but I haven't been able to find any examples.

What is the correct way to do this?