[PyQt] Styling an QMdiArea widget

David Boddie david at boddie.org.uk
Mon Apr 18 01:14:29 BST 2011


On Sun Apr 17 19:48:16 BST 2011, Sarah Mount wrote:

> Thanks, you and David were both right, the error was an incorrect path
> for the JPG. However, what I was after was to have one image appear in
> the background, and not to have the image tiled. This is possible
> using a style sheet, but I'm not sure a) if it's possible using a
> brush (your code comes out with the image tiled) or b) whether it's
> possible to use a style sheet, as my code for that didn't work!

I think the answers are:

 a) You can't really use a brush for this because it only supports
    tiled textures.
 b) QMdiArea doesn't support style sheets:
    http://doc.qt.nokia.com/4.7/stylesheet-reference.html

However, I looked at qtconfig, one of the tools shipped with Qt, and it
seems that there's a trick you can use if you are able to create a QMdiArea
subclass and use that instead of a regular QMdiArea widget:

http://www.diotavelli.net/PyQtWiki/Adding_a_background_image_to_an_MDI_area

David


More information about the PyQt mailing list