如何为 QMacStyle 获取整个 Qt 样式表 [英] How to obtain entire Qt StyleSheet for QMacStyle
问题描述
是否可以获得QMacStyle的整个Qt5 StyleSheet的文本文件a>(或在 Qt5 中显然使用的等效 QProxyStyle)?
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)?
我希望得到所有属性的列表:值对('background-color'、'border-radius'、'margin-top'、'padding'等),以及它们的默认设置,用于每个常见的小部件(QPushButton、QTabBar 等).
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.).
Mac OSX 上的 Qt5 看起来很棒,因为它具有所有原生外观的小部件(参见例如 Macintosh 风格小部件库).我想在我的应用程序中对许多样式属性进行一些外科手术替换,但否则保留本机外观.(对这个问题的另一种看法,或者至少在同一个最终目标上,在我的相关问题中有所体现如何在 Qt 样式表中仅覆盖一个 property:value 对.)
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.)
如果我知道 QTabBar 或 QPushButton 的整个 Qt 样式表等价物,我可以在我自己的 widget->setStyleSheet()
调用中重建本机外观,并添加我的一些必要的调整.
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.
我搜索了整个 Qt5.4.0 目录,希望找到一个代表 OSX 风格的 *.qss
文件,但无济于事(我发现了很有希望命名的 examples/widgets/widgets/stylesheet/qss/default.qss
,但里面只写了 ///* 空样式表 *//
).我已经用尽了在完整的 Qt5 源目录上运行 grep
的想法,包括在 qt-everywhere-enterprise-src-5.4.0/qtbase/src/widgets/styles/
,其中可能确实包含细节,但不是很容易理解的形式).
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).
谢谢——
推荐答案
QMacStyle
是一个 QStyle
子类,它使用 Apple 的 HITheme
进行绘图(查找文件 qmacstyle_mac*
以查看实现),因此无需获取样式表.
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.
这篇关于如何为 QMacStyle 获取整个 Qt 样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!