Q3DTheme#

Q3DTheme class provides a visual style for graphs. More

Synopsis#

Functions#

Signals#

Detailed Description#

Specifies visual properties that affect the whole graph. There are several built-in themes that can be used as is or modified freely.

The following properties can be overridden by using QAbstract3DSeries properties to set them explicitly in the series: baseColors , baseGradients , and colorStyle .

Themes can be created from scratch using the ThemeUserDefined enum value. Creating a theme using the default constructor produces a new user-defined theme.

Default Theme#

The following table lists the properties controlled by themes and the default values for ThemeUserDefined .

Property

Default Value

ambientLightStrength

0.25

backgroundColor

black

backgroundEnabled

true

baseColors

black

baseGradients

QLinearGradient . Essentially fully black.

colorStyle

ColorStyleUniform

font

QFont

gridEnabled

true

gridLineColor

white

highlightLightStrength

7.5

labelBackgroundColor

gray

labelBackgroundEnabled

true

labelBorderEnabled

true

labelTextColor

white

lightColor

white

lightStrength

5.0

multiHighlightColor

blue

multiHighlightGradient

QLinearGradient . Essentially fully black.

singleHighlightColor

red

singleHighlightGradient

QLinearGradient . Essentially fully black.

windowColor

black

Usage Examples#

Creating a built-in theme without any modifications:

theme = Q3DTheme(Q3DTheme.ThemeQt)

Creating a built-in theme and modifying some properties:

theme = Q3DTheme(Q3DTheme.ThemeQt)
theme.setBackgroundEnabled(False)
theme.setLabelBackgroundEnabled(False)

Creating a user-defined theme:

theme = Q3DTheme()
theme.setAmbientLightStrength(0.3f)
theme.setBackgroundColor(QColor(QRgb(0x99ca53)))
theme.setBackgroundEnabled(True)
theme.setBaseColor(QColor(QRgb(0x209fdf)))
theme.setColorStyle(Q3DTheme.ColorStyleUniform)
theme.setFont(QFont(QStringLiteral("Impact"), 35))
theme.setGridEnabled(True)
theme.setGridLineColor(QColor(QRgb(0x99ca53)))
theme.setHighlightLightStrength(7.0f)
theme.setLabelBackgroundColor(QColor(0xf6, 0xa6, 0x25, 0xa0))
theme.setLabelBackgroundEnabled(True)
theme.setLabelBorderEnabled(True)
theme.setLabelTextColor(QColor(QRgb(0x404044)))
theme.setLightColor(Qt.white)
theme.setLightStrength(6.0f)
theme.setMultiHighlightColor(QColor(QRgb(0x6d5fd5)))
theme.setSingleHighlightColor(QColor(QRgb(0xf6a625)))
theme.setWindowColor(QColor(QRgb(0xffffff)))

Creating a built-in theme and modifying some properties after it has been set:

graph = Q3DBars()
graph.activeTheme().setType(Q3DTheme.ThemePrimaryColors)
graph.activeTheme().setBaseColor(Qt.red)
graph.activeTheme().setSingleHighlightColor(Qt.yellow)
class PySide6.QtDataVisualization.Q3DTheme(themeType[, parent=None])#

PySide6.QtDataVisualization.Q3DTheme([parent=None])

Parameters

Constructs a new theme with themeType, which can be one of the built-in themes from Theme . An optional parent parameter can be given and is then passed to QObject constructor.

Constructs a new theme of type ThemeUserDefined . An optional parent parameter can be given and is then passed to QObject constructor.

PySide6.QtDataVisualization.Q3DTheme.ColorStyle#

Color styles.

Constant

Description

Q3DTheme.ColorStyleUniform

Objects are rendered in a single color. The color used is specified in baseColors , singleHighlightColor and multiHighlightColor properties.

Q3DTheme.ColorStyleObjectGradient

Objects are colored using a full gradient for each object regardless of object height. The gradient used is specified in baseGradients , singleHighlightGradient and multiHighlightGradient properties.

Q3DTheme.ColorStyleRangeGradient

Objects are colored using a portion of the full gradient determined by the object’s height and its position on the Y-axis. The gradient used is specified in baseGradients , singleHighlightGradient and multiHighlightGradient properties.

PySide6.QtDataVisualization.Q3DTheme.Theme#

Built-in themes.

Constant

Description

Q3DTheme.ThemeQt

A light theme with green as the base color.

Q3DTheme.ThemePrimaryColors

A light theme with yellow as the base color.

Q3DTheme.ThemeDigia

A light theme with gray as the base color.

Q3DTheme.ThemeStoneMoss

A medium dark theme with yellow as the base color.

Q3DTheme.ThemeArmyBlue

A medium light theme with blue as the base color.

Q3DTheme.ThemeRetro

A medium light theme with brown as the base color.

Q3DTheme.ThemeEbony

A dark theme with white as the base color.

Q3DTheme.ThemeIsabelle

A dark theme with yellow as the base color.

Q3DTheme.ThemeUserDefined

A user-defined theme. For more information, see Default Theme .

PySide6.QtDataVisualization.Q3DTheme.ambientLightStrength()#
Return type

float

This property holds The ambient light strength for the whole graph..

This value determines how evenly and brightly the colors are shown throughout the graph regardless of the light position.

The value must be between 0.0f and 1.0f.

PySide6.QtDataVisualization.Q3DTheme.ambientLightStrengthChanged(strength)#
Parameters

strength – float

PySide6.QtDataVisualization.Q3DTheme.backgroundColor()#
Return type

PySide6.QtGui.QColor

This property holds The color of the graph background..

PySide6.QtDataVisualization.Q3DTheme.backgroundColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor

PySide6.QtDataVisualization.Q3DTheme.backgroundEnabledChanged(enabled)#
Parameters

enabled – bool

PySide6.QtDataVisualization.Q3DTheme.baseColors()#
Return type

This property holds The list of base colors to be used for all the objects in the graph, series by series..

If there are more series than colors, the color list wraps and starts again with the first color in the list.

Has no immediate effect if colorStyle is not ColorStyleUniform .

This value can be overridden by setting the baseColor explicitly in the series.

PySide6.QtDataVisualization.Q3DTheme.baseColorsChanged(colors)#
Parameters

colors

PySide6.QtDataVisualization.Q3DTheme.baseGradients()#
Return type

This property holds The list of base gradients to be used for all the objects in the graph, series by series..

If there are more series than gradients, the gradient list wraps and starts again with the first gradient in the list

Has no immediate effect if colorStyle is ColorStyleUniform .

This value can be overridden by setting the baseGradient explicitly in the series.

PySide6.QtDataVisualization.Q3DTheme.baseGradientsChanged(gradients)#
Parameters

gradients

PySide6.QtDataVisualization.Q3DTheme.colorStyle()#
Return type

ColorStyle

This property holds The style of the graph colors..

One of the ColorStyle enum values.

This value can be overridden by setting colorStyle explicitly in the series.

PySide6.QtDataVisualization.Q3DTheme.colorStyleChanged(style)#
Parameters

styleColorStyle

PySide6.QtDataVisualization.Q3DTheme.font()#
Return type

PySide6.QtGui.QFont

This property holds The font to be used for labels..

PySide6.QtDataVisualization.Q3DTheme.fontChanged(font)#
Parameters

fontPySide6.QtGui.QFont

PySide6.QtDataVisualization.Q3DTheme.gridEnabledChanged(enabled)#
Parameters

enabled – bool

PySide6.QtDataVisualization.Q3DTheme.gridLineColor()#
Return type

PySide6.QtGui.QColor

This property holds The color of the grid lines..

PySide6.QtDataVisualization.Q3DTheme.gridLineColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor

PySide6.QtDataVisualization.Q3DTheme.highlightLightStrength()#
Return type

float

This property holds The specular light strength for selected objects..

The value must be between 0.0f and 10.0f.

PySide6.QtDataVisualization.Q3DTheme.highlightLightStrengthChanged(strength)#
Parameters

strength – float

PySide6.QtDataVisualization.Q3DTheme.isBackgroundEnabled()#
Return type

bool

This property holds Whether the background is visible..

The background is drawn by using the value of backgroundColor .

PySide6.QtDataVisualization.Q3DTheme.isGridEnabled()#
Return type

bool

This property holds Whether the grid lines are drawn..

This value affects all grid lines.

PySide6.QtDataVisualization.Q3DTheme.isLabelBackgroundEnabled()#
Return type

bool

This property holds Whether the label is drawn with a color background or with a fully transparent background..

The labelBackgroundColor value (including alpha) is used for drawing the background.

Labels with a background are drawn to equal sizes per axis based on the longest label, and the text is centered in them. Labels without a background are drawn as is and are left or right aligned based on their position in the graph.

PySide6.QtDataVisualization.Q3DTheme.isLabelBorderEnabled()#
Return type

bool

This property holds Whether label borders are drawn for labels that have a background..

Has no effect if labelBackgroundEnabled is false.

PySide6.QtDataVisualization.Q3DTheme.labelBackgroundColor()#
Return type

PySide6.QtGui.QColor

This property holds The color of the label backgrounds..

Has no effect if labelBackgroundEnabled is false.

PySide6.QtDataVisualization.Q3DTheme.labelBackgroundColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor

PySide6.QtDataVisualization.Q3DTheme.labelBackgroundEnabledChanged(enabled)#
Parameters

enabled – bool

PySide6.QtDataVisualization.Q3DTheme.labelBorderEnabledChanged(enabled)#
Parameters

enabled – bool

PySide6.QtDataVisualization.Q3DTheme.labelTextColor()#
Return type

PySide6.QtGui.QColor

This property holds The color of the font used for labels..

PySide6.QtDataVisualization.Q3DTheme.labelTextColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor

PySide6.QtDataVisualization.Q3DTheme.lightColor()#
Return type

PySide6.QtGui.QColor

This property holds The color for the ambient and specular light..

This value affects the light specified in Q3DScene .

PySide6.QtDataVisualization.Q3DTheme.lightColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor

PySide6.QtDataVisualization.Q3DTheme.lightStrength()#
Return type

float

This property holds The specular light strength for the whole graph..

The value must be between 0.0f and 10.0f.

This value affects the light specified in Q3DScene .

PySide6.QtDataVisualization.Q3DTheme.lightStrengthChanged(strength)#
Parameters

strength – float

PySide6.QtDataVisualization.Q3DTheme.multiHighlightColor()#
Return type

PySide6.QtGui.QColor

This property holds The highlight color for selected objects..

Used if selectionMode has the QAbstract3DGraph::SelectionRow or QAbstract3DGraph::SelectionColumn flag set.

PySide6.QtDataVisualization.Q3DTheme.multiHighlightColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor

PySide6.QtDataVisualization.Q3DTheme.multiHighlightGradient()#
Return type

PySide6.QtGui.QLinearGradient

This property holds The highlight gradient for selected objects..

Used if selectionMode has the QAbstract3DGraph::SelectionRow or QAbstract3DGraph::SelectionColumn flag set.

PySide6.QtDataVisualization.Q3DTheme.multiHighlightGradientChanged(gradient)#
Parameters

gradientPySide6.QtGui.QLinearGradient

PySide6.QtDataVisualization.Q3DTheme.setAmbientLightStrength(strength)#
Parameters

strength – float

This property holds The ambient light strength for the whole graph..

This value determines how evenly and brightly the colors are shown throughout the graph regardless of the light position.

The value must be between 0.0f and 1.0f.

PySide6.QtDataVisualization.Q3DTheme.setBackgroundColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The color of the graph background..

PySide6.QtDataVisualization.Q3DTheme.setBackgroundEnabled(enabled)#
Parameters

enabled – bool

This property holds Whether the background is visible..

The background is drawn by using the value of backgroundColor .

PySide6.QtDataVisualization.Q3DTheme.setBaseColors(colors)#
Parameters

colors

This property holds The list of base colors to be used for all the objects in the graph, series by series..

If there are more series than colors, the color list wraps and starts again with the first color in the list.

Has no immediate effect if colorStyle is not ColorStyleUniform .

This value can be overridden by setting the baseColor explicitly in the series.

PySide6.QtDataVisualization.Q3DTheme.setBaseGradients(gradients)#
Parameters

gradients

This property holds The list of base gradients to be used for all the objects in the graph, series by series..

If there are more series than gradients, the gradient list wraps and starts again with the first gradient in the list

Has no immediate effect if colorStyle is ColorStyleUniform .

This value can be overridden by setting the baseGradient explicitly in the series.

PySide6.QtDataVisualization.Q3DTheme.setColorStyle(style)#
Parameters

styleColorStyle

This property holds The style of the graph colors..

One of the ColorStyle enum values.

This value can be overridden by setting colorStyle explicitly in the series.

PySide6.QtDataVisualization.Q3DTheme.setFont(font)#
Parameters

fontPySide6.QtGui.QFont

This property holds The font to be used for labels..

PySide6.QtDataVisualization.Q3DTheme.setGridEnabled(enabled)#
Parameters

enabled – bool

This property holds Whether the grid lines are drawn..

This value affects all grid lines.

PySide6.QtDataVisualization.Q3DTheme.setGridLineColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The color of the grid lines..

PySide6.QtDataVisualization.Q3DTheme.setHighlightLightStrength(strength)#
Parameters

strength – float

This property holds The specular light strength for selected objects..

The value must be between 0.0f and 10.0f.

PySide6.QtDataVisualization.Q3DTheme.setLabelBackgroundColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The color of the label backgrounds..

Has no effect if labelBackgroundEnabled is false.

PySide6.QtDataVisualization.Q3DTheme.setLabelBackgroundEnabled(enabled)#
Parameters

enabled – bool

This property holds Whether the label is drawn with a color background or with a fully transparent background..

The labelBackgroundColor value (including alpha) is used for drawing the background.

Labels with a background are drawn to equal sizes per axis based on the longest label, and the text is centered in them. Labels without a background are drawn as is and are left or right aligned based on their position in the graph.

PySide6.QtDataVisualization.Q3DTheme.setLabelBorderEnabled(enabled)#
Parameters

enabled – bool

This property holds Whether label borders are drawn for labels that have a background..

Has no effect if labelBackgroundEnabled is false.

PySide6.QtDataVisualization.Q3DTheme.setLabelTextColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The color of the font used for labels..

PySide6.QtDataVisualization.Q3DTheme.setLightColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The color for the ambient and specular light..

This value affects the light specified in Q3DScene .

PySide6.QtDataVisualization.Q3DTheme.setLightStrength(strength)#
Parameters

strength – float

This property holds The specular light strength for the whole graph..

The value must be between 0.0f and 10.0f.

This value affects the light specified in Q3DScene .

PySide6.QtDataVisualization.Q3DTheme.setMultiHighlightColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The highlight color for selected objects..

Used if selectionMode has the QAbstract3DGraph::SelectionRow or QAbstract3DGraph::SelectionColumn flag set.

PySide6.QtDataVisualization.Q3DTheme.setMultiHighlightGradient(gradient)#
Parameters

gradientPySide6.QtGui.QLinearGradient

This property holds The highlight gradient for selected objects..

Used if selectionMode has the QAbstract3DGraph::SelectionRow or QAbstract3DGraph::SelectionColumn flag set.

PySide6.QtDataVisualization.Q3DTheme.setSingleHighlightColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The highlight color for a selected object..

Used if selectionMode has the QAbstract3DGraph::SelectionItem flag set.

PySide6.QtDataVisualization.Q3DTheme.setSingleHighlightGradient(gradient)#
Parameters

gradientPySide6.QtGui.QLinearGradient

This property holds The highlight gradient for a selected object..

Used if selectionMode has the QAbstract3DGraph::SelectionItem flag set.

PySide6.QtDataVisualization.Q3DTheme.setType(themeType)#
Parameters

themeTypeTheme

This property holds The type of the theme..

The type is automatically set when constructing a theme, but can also be changed later. Changing the theme type will change all other properties of the theme to what the predefined theme specifies. Changing the theme type of the active theme of the graph will also reset all attached series to use the new theme.

PySide6.QtDataVisualization.Q3DTheme.setWindowColor(color)#
Parameters

colorPySide6.QtGui.QColor

This property holds The color of the application window the graph is drawn into..

PySide6.QtDataVisualization.Q3DTheme.singleHighlightColor()#
Return type

PySide6.QtGui.QColor

This property holds The highlight color for a selected object..

Used if selectionMode has the QAbstract3DGraph::SelectionItem flag set.

PySide6.QtDataVisualization.Q3DTheme.singleHighlightColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor

PySide6.QtDataVisualization.Q3DTheme.singleHighlightGradient()#
Return type

PySide6.QtGui.QLinearGradient

This property holds The highlight gradient for a selected object..

Used if selectionMode has the QAbstract3DGraph::SelectionItem flag set.

PySide6.QtDataVisualization.Q3DTheme.singleHighlightGradientChanged(gradient)#
Parameters

gradientPySide6.QtGui.QLinearGradient

PySide6.QtDataVisualization.Q3DTheme.type()#
Return type

Theme

This property holds The type of the theme..

The type is automatically set when constructing a theme, but can also be changed later. Changing the theme type will change all other properties of the theme to what the predefined theme specifies. Changing the theme type of the active theme of the graph will also reset all attached series to use the new theme.

PySide6.QtDataVisualization.Q3DTheme.typeChanged(themeType)#
Parameters

themeTypeTheme

PySide6.QtDataVisualization.Q3DTheme.windowColor()#
Return type

PySide6.QtGui.QColor

This property holds The color of the application window the graph is drawn into..

PySide6.QtDataVisualization.Q3DTheme.windowColorChanged(color)#
Parameters

colorPySide6.QtGui.QColor