Q3DTheme#

Q3DTheme class provides a visual style for graphs. More

Inheritance diagram of PySide6.QtDataVisualization.Q3DTheme

Synopsis#

Properties#

Functions#

Signals#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

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("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.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtDataVisualization.Q3DTheme.ambientLightStrength: 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.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.backgroundColor: PySide6.QtGui.QColor#

This property holds The color of the graph background..

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.backgroundEnabled: bool#

This property holds Whether the background is visible..

The background is drawn by using the value of backgroundColor .

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.baseColors#

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.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.baseGradients#

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.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.colorStyle: 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.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.font: PySide6.QtGui.QFont#

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

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.gridEnabled: bool#

This property holds Whether the grid lines are drawn..

This value affects all grid lines.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.gridLineColor: PySide6.QtGui.QColor#

This property holds The color of the grid lines..

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.highlightLightStrength: float#

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

The value must be between 0.0f and 10.0f.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.labelBackgroundColor: PySide6.QtGui.QColor#

This property holds The color of the label backgrounds..

Has no effect if labelBackgroundEnabled is false.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.labelBackgroundEnabled: 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.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.labelBorderEnabled: bool#

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

Has no effect if labelBackgroundEnabled is false.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.labelTextColor: PySide6.QtGui.QColor#

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

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.lightColor: PySide6.QtGui.QColor#

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

This value affects the light specified in Q3DScene .

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.lightStrength: 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 .

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.multiHighlightColor: PySide6.QtGui.QColor#

This property holds The highlight color for selected objects..

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

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.multiHighlightGradient: PySide6.QtGui.QLinearGradient#

This property holds The highlight gradient for selected objects..

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

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.singleHighlightColor: PySide6.QtGui.QColor#

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

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

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.singleHighlightGradient: PySide6.QtGui.QLinearGradient#

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

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

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.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.

Access functions:
property PᅟySide6.QtDataVisualization.Q3DTheme.windowColor: PySide6.QtGui.QColor#

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

Access functions:
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

Getter of property ambientLightStrength .

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

strength – float

Notification signal of property ambientLightStrength .

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

PySide6.QtGui.QColor

Getter of property backgroundColor .

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

colorPySide6.QtGui.QColor

Notification signal of property backgroundColor .

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

enabled – bool

Notification signal of property backgroundEnabled .

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

See also

setBaseColors()

Getter of property baseColors .

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

colors

Notification signal of property baseColors .

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

Getter of property baseGradients .

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

gradients

Notification signal of property baseGradients .

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

ColorStyle

See also

setColorStyle()

Getter of property colorStyle .

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

styleColorStyle

Notification signal of property colorStyle .

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

PySide6.QtGui.QFont

See also

setFont()

Getter of property font .

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

fontPySide6.QtGui.QFont

Notification signal of property font .

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

enabled – bool

Notification signal of property gridEnabled .

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

PySide6.QtGui.QColor

Getter of property gridLineColor .

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

colorPySide6.QtGui.QColor

Notification signal of property gridLineColor .

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

float

Getter of property highlightLightStrength .

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

strength – float

Notification signal of property highlightLightStrength .

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

bool

Getter of property backgroundEnabled .

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

bool

Getter of property gridEnabled .

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

bool

Getter of property labelBackgroundEnabled .

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

bool

Getter of property labelBorderEnabled .

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

PySide6.QtGui.QColor

Getter of property labelBackgroundColor .

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

colorPySide6.QtGui.QColor

Notification signal of property labelBackgroundColor .

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

enabled – bool

Notification signal of property labelBackgroundEnabled .

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

enabled – bool

Notification signal of property labelBorderEnabled .

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

PySide6.QtGui.QColor

Getter of property labelTextColor .

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

colorPySide6.QtGui.QColor

Notification signal of property labelTextColor .

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

PySide6.QtGui.QColor

See also

setLightColor()

Getter of property lightColor .

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

colorPySide6.QtGui.QColor

Notification signal of property lightColor .

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

float

Getter of property lightStrength .

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

strength – float

Notification signal of property lightStrength .

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

PySide6.QtGui.QColor

Getter of property multiHighlightColor .

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

colorPySide6.QtGui.QColor

Notification signal of property multiHighlightColor .

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

PySide6.QtGui.QLinearGradient

Getter of property multiHighlightGradient .

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

gradientPySide6.QtGui.QLinearGradient

Notification signal of property multiHighlightGradient .

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

strength – float

Setter of property ambientLightStrength .

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

colorPySide6.QtGui.QColor

Setter of property backgroundColor .

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

enabled – bool

Setter of property backgroundEnabled .

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

colors

See also

baseColors()

Setter of property baseColors .

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

gradients

See also

baseGradients()

Setter of property baseGradients .

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

styleColorStyle

See also

colorStyle()

Setter of property colorStyle .

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

fontPySide6.QtGui.QFont

See also

font()

Setter of property font .

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

enabled – bool

See also

isGridEnabled()

Setter of property gridEnabled .

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

colorPySide6.QtGui.QColor

See also

gridLineColor()

Setter of property gridLineColor .

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

strength – float

Setter of property highlightLightStrength .

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

colorPySide6.QtGui.QColor

Setter of property labelBackgroundColor .

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

enabled – bool

Setter of property labelBackgroundEnabled .

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

enabled – bool

Setter of property labelBorderEnabled .

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

colorPySide6.QtGui.QColor

See also

labelTextColor()

Setter of property labelTextColor .

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

colorPySide6.QtGui.QColor

See also

lightColor()

Setter of property lightColor .

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

strength – float

See also

lightStrength()

Setter of property lightStrength .

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

colorPySide6.QtGui.QColor

Setter of property multiHighlightColor .

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

gradientPySide6.QtGui.QLinearGradient

Setter of property multiHighlightGradient .

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

colorPySide6.QtGui.QColor

Setter of property singleHighlightColor .

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

gradientPySide6.QtGui.QLinearGradient

Setter of property singleHighlightGradient .

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

themeTypeTheme

See also

type()

Setter of property type .

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

colorPySide6.QtGui.QColor

See also

windowColor()

Setter of property windowColor .

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

PySide6.QtGui.QColor

Getter of property singleHighlightColor .

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

colorPySide6.QtGui.QColor

Notification signal of property singleHighlightColor .

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

PySide6.QtGui.QLinearGradient

Getter of property singleHighlightGradient .

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

gradientPySide6.QtGui.QLinearGradient

Notification signal of property singleHighlightGradient .

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

Theme

See also

setType()

Getter of property type .

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

themeTypeTheme

Notification signal of property type .

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

PySide6.QtGui.QColor

See also

setWindowColor()

Getter of property windowColor .

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

colorPySide6.QtGui.QColor

Notification signal of property windowColor .