Theme3D QML Type
一种图表的视觉样式。更多...
| Import Statement: | import QtDataVisualization 1.12 |
| Since: | QtDataVisualization 1.0 |
| In C++: | Q3DTheme |
| Status: | Deprecated |
此类型已弃用。我们强烈建议不要在新代码中使用它。
属性
- ambientLightStrength : real
- backgroundColor : color
- backgroundEnabled : bool
- baseColors : list<ThemeColor>
- baseGradients : list<ColorGradient>
- colorStyle : Theme3D.ColorStyle
- font : font
- gridEnabled : bool
- gridLineColor : color
- highlightLightStrength : real
- labelBackgroundColor : color
- labelBackgroundEnabled : bool
- labelBorderEnabled : bool
- labelTextColor : color
- lightColor : color
- lightStrength : real
- multiHighlightColor : color
- multiHighlightGradient : ColorGradient
- singleHighlightColor : color
- singleHighlightGradient : ColorGradient
- type : Theme3D.Theme
- windowColor : color
详细说明
此类型用于指定影响整个图表的视觉属性。有几种内置主题,既可直接使用,也可自由修改。
以下属性可通过在系列中显式设置Abstract3DSeries 属性来覆盖:baseColors 、baseGradients 和colorStyle 。
可以通过使用Theme3D.ThemeUserDefined 枚举值从头开始创建主题。
默认主题
下表列出了由主题控制的属性以及Theme3D.ThemeUserDefined 的默认值。
| 属性 | 默认值 |
|---|---|
| ambientLightStrength | 0.25 |
| backgroundColor | “black”。有关更多信息,请参阅color 。 |
| backgroundEnabled | true |
| baseColors | "black" |
| baseGradients | QLinearGradient。基本上是纯黑色。 |
| colorStyle | ColorStyleUniform |
| font | font |
| gridEnabled | true |
| gridLineColor | “白色” |
| highlightLightStrength | 7.5 |
| labelBackgroundColor | “灰色” |
| labelBackgroundEnabled | true |
| labelBorderEnabled | true |
| labelTextColor | "白色" |
| lightColor | "白色" |
| lightStrength | 5.0 |
| multiHighlightColor | “蓝色” |
| multiHighlightGradient | QLinearGradient. 基本上是纯黑。 |
| singleHighlightColor | “红色” |
| singleHighlightGradient | QLinearGradient. 实际上完全是黑色的。 |
| windowColor | “黑色” |
使用示例
直接使用内置主题,无需任何修改:
Scatter3D {
...
theme: Theme3D { type: Theme3D.ThemeRetro }
...
}使用内置主题并修改部分属性:
Bars3D {
...
theme: Theme3D {
type: Theme3D.ThemeRetro
labelBorderEnabled: true
font.pointSize: 35
labelBackgroundEnabled: false
}
...
}使用自定义主题:
Surface3D {
...
theme: Theme3D {
ambientLightStrength: 0.5
backgroundColor: "red"
backgroundEnabled: true
baseColor: "blue"
colorStyle: Theme3D.ColorStyleUniform
font.family: "Lucida Handwriting"
font.pointSize: 35
gridEnabled: false
gridLineColor: "black"
highlightLightStrength: 0.5
labelBackgroundColor: "black"
labelBackgroundEnabled: true
labelBorderEnabled: false
labelTextColor: "white"
lightColor: "yellow"
lightStrength: 0.4
multiHighlightColor: "green"
singleHighlightColor: "darkRed"
windowColor: "white"
}
...
}有关 Theme3D 枚举,请参阅Q3DTheme::ColorStyle 和Q3DTheme::Theme 。
属性文档
ambientLightStrength : real
整个图表的环境光强度。该值决定了图表中各处的颜色显示是否均匀且明亮,无论光源位置如何。该值必须在0.0 和1.0 之间。
backgroundColor : color
图表背景的颜色。
backgroundEnabled : bool
指定是否使用backgroundColor 的值来绘制背景。
baseColors : list<ThemeColor>
用于图中所有对象的基础颜色列表,按系列依次排列。如果系列数量多于颜色数量,颜色列表将循环显示,并从列表中的第一个颜色开始重复。如果colorStyle 未设置为Theme3D.ColorStyleUniform ,则此设置不会立即生效。
可以通过在数据系列中显式设置Abstract3DSeries.baseColor 来覆盖此行为。
baseGradients : list<ColorGradient>
按系列顺序列出的、用于图表中所有对象的基础渐变列表。如果系列数量多于渐变数量,渐变列表将循环显示,并从列表中的第一个渐变开始重新显示。
如果 `colorStyle ` 的值为 `Theme3D.ColorStyleUniform`,则此设置不会立即生效。
可以通过在系列中显式设置Abstract3DSeries.baseGradient 来覆盖此值。
colorStyle : Theme3D.ColorStyle
图表颜色的样式。Q3DTheme::ColorStyle 枚举值之一。
可以通过在系列中显式设置Abstract3DSeries.colorStyle 来覆盖此值。
另请参阅 Q3DTheme::ColorStyle 。
font : font
设置标签所使用的字体。
gridEnabled : bool
用于指定是否绘制网格线。该值将影响所有网格线。
gridLineColor : color
网格线的颜色。
注意: 不支持透明度 ,否则将导致未定义行为。
highlightLightStrength : real
所选对象的镜面光强度。该值必须在0.0 和10.0 之间。
labelBackgroundColor : color
标签背景的颜色。如果labelBackgroundEnabled 的值为false ,则此设置无效。
labelBackgroundEnabled : bool
指定标签是使用labelBackgroundColor (包括透明度)作为背景绘制,还是使用完全透明的背景绘制。带有背景的标签会根据最长的标签,在每个坐标轴上以相同大小绘制,且文本在其中居中显示。没有背景的标签则按原样绘制,并根据其在图表中的位置左对齐或右对齐。
labelBorderEnabled : bool
指定是否为带有背景的标签绘制边框。如果labelBackgroundEnabled 的值为false ,则此设置无效。
labelTextColor : color
标签所用字体的颜色。
lightColor : color
在 Scene3D 中定义的环境光和镜面光颜色。
lightStrength : real
整个图的镜面光强度。该值必须在0.0 和10.0 之间。
该值会影响 Scene3D 中指定的光照。
multiHighlightColor : color
所选对象的高亮颜色。当selectionMode 设置了AbstractGraph3D.SelectionRow 或AbstractGraph3D.SelectionColumn 标志时使用。
注意: 不支持透明度 ,否则将导致未定义的行为。
multiHighlightGradient : ColorGradient
所选对象的高光渐变。当selectionMode 设置了AbstractGraph3D.SelectionRow 或AbstractGraph3D.SelectionColumn 标志时使用。
注意: 不支持透明度 ,否则将导致未定义的行为。
singleHighlightColor : color
所选对象的高亮颜色。当selectionMode 设置了AbstractGraph3D.SelectionItem 标志时使用。
注意: 不支持透明度, 否则将导致未定义的行为。
singleHighlightGradient : ColorGradient
所选对象的高光渐变。当selectionMode 设置了AbstractGraph3D.SelectionItem 标志时使用。
注意: 不支持透明度, 否则将导致未定义的行为。
type : Theme3D.Theme
主题的类型。如果未设置类型,则类型默认为Theme3D.ThemeUserDefined 。在项构建完成后更改主题类型,将把该主题的所有其他属性更改为预定义主题所指定的值。更改图中活动主题的类型,也会将所有关联的系列重置为使用新主题。
windowColor : color
绘制图表的应用程序窗口的颜色。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.