Question

I came to know that we can use CSS stylings in PyQt but I am not able to use all the CSS code effectively...

when I try this code ..(all the remaining code is correct..)

QPushButton { transition: opacity 1s ease-in-out; box-shadow: 0px 1px 0px 0px #fff6af; background-color:#ffec64; border-radius:6px; border:1px solid #ffaa22; display:inline-block; cursor:pointer; color:#000000; text-decoration:none; text-shadow:0px 1px 0px #ffee66; }

I get the following error

Unknown property transition
Unknown property box-shadow
Unknown property display
Unknown property cursor
Unknown property text-shadow

Is there any way I can use all these properties i pyqt application...?

Was it helpful?

Solution

Not all CSS properties are supported in QSS, and there are also some additional properties which are specific to Qt. Also, the set of supported properties is not available for all widgets.

To see what's supported, see the List of Properties in the Style Sheets Reference. You should probably also take a look at the Style Sheets Overview and the Style Sheet Syntax guide.

OTHER TIPS

I believe you can't set these properties using QSS and you should look for alternatives to set this properties. For instance, to change the cursor to pointer you can do the following:

self.setCursor(QtCore.Qt.PointingHandCursor)

You can find the various cursors that can be used here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top