Stylesheets and plasma widgets

alanm me at alandmoore.com
Thu Sep 10 23:04:40 CEST 2009


On Thursday 10 September 2009 2:29:09 pm Aaron J. Seigo wrote:
> On September 10, 2009, alanm wrote:
> > I have a plasmoid (in Python) which uses Plasma.ToolButton widgets.  I
> >  would like to allow the user to override the default style (taken from
> > the plasma theme) of the buttons (for instance, to change
> > font/size/colors).
> 
> why?
> 
Basically, I'm creating a launcher something like quicklaunch that allows you 
to use text instead of icons.  Since the text is the main focus of the 
plasmoid, I wanted to give the user the ability to customize it a bit.  Using 
the built in style works OK, but depending on screen size/font size/plasma 
theme it might be nice to adjust this (cf. the digital clock plasmoid).

> >  - First, I find that if I give the button a stylesheet using
> >  setStyleSheet(), the style sheet in use is totally blown away.  Is there
> 
> yes; that's due to how it works in Qt (which is "not overly well").
> stylesheets are orthogonal to the svg styles we currently use, so we fall
>  back to what Qt can provide when it comes to style sheets. you are then
>  within the limitations of Qt at that point.
> 
Is there a better way to make these kinds of small adjustments apart from 
style sheets?

> >  - Second, if I must override the entire style sheet for the button, how
> > do I set the hover style of the button?
> 
> what exactly are you trying to achieve?
> 
I don't really need to adjust the hover style and whatnot, but if I have to 
recreate the whole stylesheet to adjust anything, I wasn't sure how to go 
about recreating those sorts of things.  If there's a better way to accomplish 
all of this without style sheets then it's moot.

Thanks .


More information about the Plasma-devel mailing list