Qt stylesheets : per-user default qss capability? (was Re: how to use kdialog --font ?)

Stephen Dowdy sdowdy at ucar.edu
Tue Oct 27 23:20:47 GMT 2015


On Tue, Oct 27, 2015 at 1:24 PM, Kevin Krammer <krammer at kde.org> wrote:

>
> CTRL+SHIFT+Left Click on any part in the observed application (in your case
> kdialog), should jump to that object in Gammaray's tree.
>
> You can then also adjust properties at runtime, e.g. the stylesheet
> property.
>
> See http://doc.qt.io/qt-4.8/stylesheet-examples.html for small example
> stylesheets.
>
>

​Kevin,​

Great stuff, exactly what i was looking for.

​'strace' reveals no default search for .qss files (at least in
'kdialog').  ​
​So, is there a way to create a user stylesheet that all Qt apps will
reference?   One that can be obtained via Environment Variable or perhaps
an entry (or several) in Trolltech.conf?
( adding a key "style=windows" to the INI group "[Qt]" in Trolltech.conf
will do the same (i think) as setting your KDE default Qt Widget style, but
it'd be nice to have a stylesheet key, which i can't find reference for)

    QT_STYLE_OVERRIDE="windows" kdialog --msgbox "$(lsblk)"
doesn't seem to work, so maybe that's a Qt5 only thing  (kdialog --style
"windows", however, does work as expected)


If so, one could create a "userStyle.qss" that had stuff like:​

​
KDialog > QWidget > QLabel {
    font-family: monospace;
    font-size: 16;
    background-color: rgb(40,40,40);
    color:rgb(220,220,220);
}

​which, theoretically should only apply to KDialog (executable, or i think
there's an API?)
(unfortunately, the labels in KDialog don't have class/id AFAICT, so you
hit all of them)

But having one place to tweak styles would be useful.

I suppose this is getting low-level enough that reliance from one release
to another might get "iffy".

thanks,
--stephen


-- 
Stephen Dowdy  -  Systems Administrator  -  NCAR/RAL
303.497.2869   -  sdowdy at ucar.edu        -  http://www.ral.ucar.edu/~sdowdy/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde/attachments/20151027/51ec423a/attachment.htm>
-------------- next part --------------
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.


More information about the kde mailing list