neeme |
2018-02-06 16:41 |
怎样使用公共属性
你好: 我想设定一些公共的定义,以统一各个QML的风格。 于是找到一个文件 UIStyle(内容如下)放在同一目录, 但当我在其它QML 引用这些属性时报错。Unable to assign [undefined] to QColor 请问是什么原因,谢谢! Rectangle { color: UIStyle.colorQtGray1 } import QtQuick 2.7 pragma Singleton QtObject { id: uiStyle // Font Sizes readonly property int fontSizeXXS: 10 readonly property int fontSizeXS: 15 readonly property int fontSizeS: 20 readonly property int fontSizeM: 25 readonly property int fontSizeL: 30 readonly property int fontSizeXL: 35 readonly property int fontSizeXXL: 40 // Color Scheme // Green readonly property color colorQtPrimGreen: "#41cd52" readonly property color colorQtAuxGreen1: "#21be2b" readonly property color colorQtAuxGreen2: "#17a81a" // Gray readonly property color colorQtGray1: "#09102b" readonly property color colorQtGray2: "#222840" readonly property color colorQtGray3: "#3a4055" readonly property color colorQtGray4: "#53586b" readonly property color colorQtGray5: "#53586b" readonly property color colorQtGray6: "#848895" readonly property color colorQtGray7: "#9d9faa" readonly property color colorQtGray8: "#b5b7bf" readonly property color colorQtGray9: "#cecfd5" readonly property color colorQtGray10: "#f3f3f4" }
|
|