Stylesheets and plasma widgets
Marco Martin
notmart at gmail.com
Thu Sep 10 21:27:59 CEST 2009
On Thursday 10 September 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).
>
> I have two problems/misunderstandings I need help with here:
> - First, I find that if I give the button a stylesheet using
> setStyleSheet(), the style sheet in use is totally blown away. Is there
> any way to just append or override settings of the stylesheet in use? I
> tried this:
> button = Plasma.PushButton()
> bstyle = button.styleSheet()
> bstyle += "font: 8pt;"
> button.setStyleSheet(bstyle)
>
> But that doesn't work -- it sets the font size alright, but the other style
> aspects set by the plasma theme (font, color, etc) are gone.
> Interestingly, button.styleSheet() returns an empty string.
it's weird that is an empty string but yes, plasma widgets don't even try to
parse stylesheets, if any is set they just pass the rendering to the
underlying qwidget
> - Second, if I must override the entire style sheet for the button, how do
> I set the hover style of the button? setStyle() on the button object only
> seems to allow me to set the default style for the button. I would assume
> I could do this in the "master" stylesheet if I could access it, but I'm
> not sure how to get at it or change it. Is there an object I can call
> styleSheet() on to get the "master" stylesheet in use?
>
> Or... are style sheets just the wrong way to go about this?
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
--
Marco Martin
More information about the Plasma-devel
mailing list