[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
[code]
QLabel {
background: rgba(200,0,0);
border: 0px solid blue;
padding: 5px;
border-radius: 5px;
margin: 2px;
box-shadow: 0px -3px 5px #a6a6a6;
}
[/code]...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
-
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.