[Qt-interest] Applying background image to QMainWindow?

Mike Polan kanadakid at gmail.com
Sun Dec 27 06:38:20 CET 2009


Hi all,

I'm using the latest Qt on Mac OS X, and I'm a bit stuck on trying to set an
image as the background for a QMainWindow. What I'm looking for, is to
somehow set such an image as a background of my program's main window, and
also to let all child widgets (specifically containers like QGroupBox) have
transparent backgrounds so the image shows through. I tried setting the main
window's CSS properties like so:

// inside mainwindow.cpp -> class derives from QMainWindow
setStyleSheet("background-image: url(some_bg.png)");

This seems to work, but the problem is that EVERY child widget also tries to
display that background. That is, instead of having one, uniform background
image in the main window, I get several partial ones displayed on each
widget's background. How would I go about achieving the aforementioned
result?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091227/33f2ad37/attachment.html 


More information about the Qt-interest-old mailing list