Theme3D QML Type

图形的可视化样式更多

Import Statement: import QtDataVisualization 1.9
Since: QtDataVisualization 1.0
In C++: Q3DTheme

属性

详细描述

该类型用于指定影响整个图形的可视化属性。有几种内置主题,可按原样使用或自由修改。

通过使用Abstract3DSeries 属性,可以在系列中明确设置以下属性:baseColorsbaseGradientscolorStyle

可以使用Theme3D.ThemeUserDefined 枚举值从头开始创建主题。

默认主题

下表列出了由主题控制的属性以及Theme3D.ThemeUserDefined 的默认值。

使用示例

使用内置主题,不做任何修改:

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::ColorStyleQ3DTheme::Theme

属性文档

ambientLightStrength : real

整个图形的环境光强度。该值决定了无论灯光位置如何,颜色在整个图形中显示的均匀度和亮度。该值必须介于0.01.0 之间。


backgroundColor : color

图表背景颜色。


backgroundEnabled : bool

定义是否使用backgroundColor 的值绘制背景。


baseColors : list<ThemeColor>

用于图表中所有对象的基色列表,按系列显示。如果系列数多于颜色数,颜色列表将重新打包,并从列表中的第一种颜色开始。如果colorStyle 不是Theme3D.ColorStyleUniform ,则不会立即生效。

可以通过在系列中明确设置Abstract3DSeries.baseColor 来覆盖此功能。


baseGradients : list<ColorGradient>

用于图表中所有对象的基本渐变色列表,按系列排列。如果系列数多于渐变效果,渐变效果列表将重新打包,并从列表中的第一个渐变效果开始。

如果colorStyleTheme3D.ColorStyleUniform ,则不会立即生效。

可以通过在系列中明确设置Abstract3DSeries.baseGradient 来覆盖该值。


colorStyle : Theme3D.ColorStyle

图形颜色的样式。Q3DTheme::ColorStyle 枚举值之一。

可以通过在系列中明确设置Abstract3DSeries.colorStyle 来覆盖该值。

另请参阅 Q3DTheme::ColorStyle


font : font

设置标签使用的字体。


gridEnabled : bool

定义是否绘制网格线。此值会影响所有网格线。


gridLineColor : color

网格线的颜色。

注: 不支持透明效果,透明效果会导致未定义的行为。


highlightLightStrength : real

选定对象的镜面反射光强度。该值必须介于0.010.0 之间。


labelBackgroundColor : color

标签背景颜色。如果labelBackgroundEnabledfalse 则无影响。


labelBackgroundEnabled : bool

定义是使用labelBackgroundColor (包括 alpha)背景绘制标签,还是使用全透明背景绘制标签。有背景的标签根据最长标签绘制,每个轴的尺寸相等,文本居中。无背景的标签按原样绘制,并根据其在图表中的位置向左或向右对齐。


labelBorderEnabled : bool

定义是否为有背景的标签绘制标签边框。如果labelBackgroundEnabledfalse 则无影响。


labelTextColor : color

标签所用字体的颜色。


lightColor : color

Scene3D 中定义的环境光和镜面光的颜色。


lightStrength : real

整个图形的镜面反射光强度。该值必须介于0.010.0 之间。

该值会影响Scene3D 中指定的光线。


multiHighlightColor : color

选定对象的高亮颜色。在selectionMode 设置了AbstractGraph3D.SelectionRowAbstractGraph3D.SelectionColumn 标志时使用。

注: 不支持透明效果,会导致未定义的行为。


multiHighlightGradient : ColorGradient

选定对象的高光渐变。在selectionMode 设置了AbstractGraph3D.SelectionRowAbstractGraph3D.SelectionColumn 标志时使用。

注: 不支持透明度,会导致未定义的行为。


singleHighlightColor : color

选中对象的高亮颜色。在selectionMode 设置了AbstractGraph3D.SelectionItem 标志时使用。

注: 不支持透明度,会导致未定义的行为。


singleHighlightGradient : ColorGradient

所选对象的高光渐变。在selectionMode 设置了AbstractGraph3D.SelectionItem 标志时使用。

注: 不支持透明度,会导致未定义的行为。


type : Theme3D.Theme

主题类型。如果没有设置类型,则类型为Theme3D.ThemeUserDefined 。在构建项目后更改主题类型,会将主题的所有其他属性更改为预定义主题指定的属性。更改图表活动主题的主题类型还将重置所有附加序列,使其使用新主题。


windowColor : color

图形绘制到应用程序窗口中的颜色。


© 2025 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.