[PyQt] How to get box shadows in qlabels?
Maurizio Berti
maurizio.berti at gmail.com
Wed Mar 11 00:31:41 GMT 2020
Stylesheet features on Qt are limited, as it only supports a subset of CSS
properties (not unlike the subset of HTML for rich text); as you have
already found out, there's no box-shadow property. They are useful for
specific design purposes, can be very useful for small and easy
modifications to the widget appearance (and some other things, since they
support qproperties), and can be used to do fancy tricks without manual
painting and/or QStyle overrides, but be careful: some widgets (usually
composite widgets, like spinboxes, combo, sliders) require to be fully
implemented in the stylesheet, otherwise they won't work.
That said, I became curious about the neumorphism topic, and I decided to
give it a try, mostly because I never created a full QGraphicsEffect on my
own.
I published the answer on StackOverflow, since I believe it could be useful
to others too.
https://stackoverflow.com/questions/60626717/can-i-apply-a-neumorphism-effect-to-a-qwidget
You can see the result in the attached image, while the full description on
how it was implemented is on the link.
Cheers,
Maurizio
Il giorno lun 9 mar 2020 alle ore 03:35 Souvik Dutta <
souvik.viksou at outlook.com> ha scritto:
> I am trying to get some neumorphism effect in qlabel. I want two box
> shadows for this. Both of them will be in opposite direction, one will be
> white and another will be black. How can I do this, I mean is there an
> inbuilt function. I tried adding box-shadows, box-shadow and boxshadow in
> the style sheet but everytime it says no property called boxshadow.
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
--
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200311/c1a38271/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: neumorphism.png
Type: image/png
Size: 14018 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200311/c1a38271/attachment-0001.png>
More information about the PyQt
mailing list