[Solved] Unknown property box-shadow styling with CSS
Hi! I'm new in the forum and in Qt and I'm experimenting with CSS styles for a desktop app. I'm a Python developer so I'm using PySide.
I was looking in the internet for a solution to my problem but I did not find it. The thing is that I can't add a shadow to a QLabel using this code:
My Qt version is 4.8.3
border: 0px solid blue;
box-shadow: 0px -3px 5px #a6a6a6;
...and I get "Unknown property box-shadow".
I tried also with -webkit-box-shadow.
Well... this is all for know. Thanks and please excuse my english.
Qt widgets support only a subset of CSS. The complete list of supported properties is "here":http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#list-of-properties
Ok. Thank you Krzysztof!
For shadow you could use QGraphicsDropShadowEffect
QGraphicsDropShadowEffect is only for the items in QGraphicsView, not for widgets (unless you put a widget in QGraphicsView, but that's another story).
For simple shadows you might fake it by setting border in a CSS to a carefully crafted gradient, or subclass a QLabel, give it a little padding and draw the shadow in paintEvent.
Kawa QWidget has a property "setGraphicsEffect":http://qt-project.org/doc/qt-4.8/qwidget.html#setGraphicsEffect where you can set your QGraphicsDropShadowEffect to any QWidget derived class :)
Oh, I'm learning every day I guess :) Thanks for clearing this up.
We all learn everyday :D np
Thank you people!
The solution using qgradient color in the bordes with a CSS works well, but only with border-radius: 0px.
I will try with the QGraphicsDropShadowEffect too.
Thanks again and excuse my english.
Mark the post as solved please. Thank you