But the part about the stylsheets being converted and not stored was
definitely not right.

What you’re seeing there is merely the last command put into setStyleSheet,
it doesn’t actually represent the sum of each individual command.
Technically, the string is cached internally, into a private member of
QApplication and discarded each time it is set.

You can prove that by setting it twice.

app.setStyleSheet("QWidget { background-color: 'blue' }")
app.setStyleSheet("QWidget { font: 'verdana' }")assert
app.styleSheet() == "QWidget { font: 'verdana' }"

What’s more, it also doesn’t take into account stylesheets applied to
children within widgets or the application.

You can prove that by applying it to a widget first, and then application.
As the widget is affected by the stylesheet, one might think it should be
able to reproduce it.

widget = QtWidgets.QWidget()
app.setStyleSheet("QWidget { font: 'verdana' }")assert widget.styleSheet() == ""

Which means that unless you’re certain that the setStyleSheet command was
used only once, on only one object - either the QApplication, or a QWidget,
which are the only objects that carry this method - then it’s quite
difficult to be certain that what you get is what’s actually being drawn.

If you use a stylesheets it takes priority over a palette

I think it’s more a matter of which gets set last.

They are also supposedly a touch slower

Then what? In the above example, four QPalette roles are being set with
only one CSS directive. Some may argue that this would be faster than
setting each role manually; at least when it’s done from Python.

Maya is most likely using a custom QStyle/palette and not stylesheets.

They not necessarily mutually exclusive. Some things may be more easily set
using stylesheets, whereas others are easier/only possible via QPalette.

It’s all in the source, folks.
https://qt.gitorious.org/qt
​

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAe6iLO2CM-xVc03k59zPLN65tpKDbuqX0-VdHY_2yoBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to