问题
Is it possible to obtain a text file of the entire Qt5 StyleSheet for QMacStyle (or its equivalent QProxyStyle that's apparently used in Qt5)?
I'm hoping to get a list of all the property:value pairs ('background-color', 'border-radius', 'margin-top', 'padding', etc.), along with their default settings, that are used for each of the common widgets (QPushButton, QTabBar, etc.).
Qt5 on Mac OSX looks great due to all of the native-looking widgets (see e.g. Macintosh Style Widget Gallery). I'd like to perform some surgical replacements of a number of style properties in my application, but otherwise keep the native look-and-feel. (An alternate take on the problem, or at least on the same end goal, is represented in my related question How to override just one property:value pair in Qt StyleSheet.)
If I knew the entire Qt StyleSheet equivalent for a QTabBar or QPushButton, I could reconstruct the native look-and-feel in my own invocations of widget->setStyleSheet()
, adding in my few necessary tweaks.
I've searched the entire Qt5.4.0 directory hoping to find a *.qss
file representing OSX style, but to no avail (I found the promisingly named examples/widgets/widgets/stylesheet/qss/default.qss
, however all it says inside is //* empty stylesheet *//
). I've exhausted my ideas running grep
on the full Qt5 source directory, including in qt-everywhere-enterprise-src-5.4.0/qtbase/src/widgets/styles/
, which may indeed contain the details but not in very digestible form).
Thanks --
回答1:
QMacStyle
is a QStyle
subclass that is using Apple's HITheme
for drawing (look for the files qmacstyle_mac*
to see the implementation), so there is no stylesheet to obtain.
来源:https://stackoverflow.com/questions/28841705/how-to-obtain-entire-qt-stylesheet-for-qmacstyle