问题
How can I get the name of current style sheet of my PyQt app?
app = QtGui.QApplication.instance()
print app.styleSheet()
app.styleSheet()
returns nothing.
app = QtGui.QApplication.instance()
print app.style()
return <PyQt4.QtGui.QCommonStyle object at 0x0000000019BB4678>
I need a string, for example 'plastique'
回答1:
You can get the class name of the current style, if that's what you're looking for.
print app.style().metaObject().className()
回答2:
Qt does not use stylesheets for rendering of GUI. When you set up a stylesheet Qt generates corresponding QProxyStyle and use it. It is not possible to reverse this operation. When stylesheet is not set - then Qt may use native OS API for rendering controls.
来源:https://stackoverflow.com/questions/24012777/get-the-name-of-current-app-style-sheet-in-pyqt