[PyQt] Styling an QMdiArea widget

Sarah Mount mount.sarah at gmail.com
Mon Apr 18 07:02:05 BST 2011


On Mon, Apr 18, 2011 at 01:14, David Boddie <david at boddie.org.uk> wrote:
> 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
>

Thanks, that looks like just the thing!

Sarah

-- 
Sarah Mount, Senior Lecturer, University of Wolverhampton
website:  http://www.snim2.org/
twitter: @snim2


More information about the PyQt mailing list