Q3DTheme Class▲
-
Header: Q3DTheme
-
Since: QtDataVisualization 1.0
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
-
qmake: QT += datavisualization
-
Inherited By:
-
Instantiated By: qml-qtdatavisualization-theme3d.xml
-
Inherits: QObject
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 |
---|---|
0.25 |
|
true |
|
QLinearGradient. Essentially fully black. |
|
true |
|
7.5 |
|
true |
|
true |
|
5.0 |
|
QLinearGradient. Essentially fully black. |
|
QLinearGradient. Essentially fully black. |
|
Usage Examples▲
Creating a built-in theme without any modifications:
Q3DTheme *
theme =
new
Q3DTheme(Q3DTheme::
ThemeQt);
Creating a built-in theme and modifying some properties:
Q3DTheme *
theme =
new
Q3DTheme(Q3DTheme::
ThemeQt);
theme-&
gt;setBackgroundEnabled(false
);
theme-&
gt;setLabelBackgroundEnabled(false
);
Creating a user-defined theme:
Q3DTheme *
theme =
new
Q3DTheme();
theme-&
gt;setAmbientLightStrength(0.3
f);
theme-&
gt;setBackgroundColor(QColor(QRgb(0x99ca53
)));
theme-&
gt;setBackgroundEnabled(true
);
theme-&
gt;setBaseColor(QColor(QRgb(0x209fdf
)));
theme-&
gt;setColorStyle(Q3DTheme::
ColorStyleUniform);
theme-&
gt;setFont(QFont(QStringLiteral("Impact"
), 35
));
theme-&
gt;setGridEnabled(true
);
theme-&
gt;setGridLineColor(QColor(QRgb(0x99ca53
)));
theme-&
gt;setHighlightLightStrength(7.0
f);
theme-&
gt;setLabelBackgroundColor(QColor(0xf6
, 0xa6
, 0x25
, 0xa0
));
theme-&
gt;setLabelBackgroundEnabled(true
);
theme-&
gt;setLabelBorderEnabled(true
);
theme-&
gt;setLabelTextColor(QColor(QRgb(0x404044
)));
theme-&
gt;setLightColor(Qt::
white);
theme-&
gt;setLightStrength(6.0
f);
theme-&
gt;setMultiHighlightColor(QColor(QRgb(0x6d5fd5
)));
theme-&
gt;setSingleHighlightColor(QColor(QRgb(0xf6a625
)));
theme-&
gt;setWindowColor(QColor(QRgb(0xffffff
)));
Creating a built-in theme and modifying some properties after it has been set:
Q3DBars *
graph =
new
Q3DBars();
graph-&
gt;activeTheme()-&
gt;setType(Q3DTheme::
ThemePrimaryColors);
graph-&
gt;activeTheme()-&
gt;setBaseColor(Qt::
red);
graph-&
gt;activeTheme()-&
gt;setSingleHighlightColor(Qt::
yellow);
Member Type Documentation▲
enum Q3DTheme::ColorStyle▲
Color styles.
Constant |
Value |
Description |
---|---|---|
Q3DTheme::ColorStyleUniform |
0 |
Objects are rendered in a single color. The color used is specified in baseColors, singleHighlightColor and multiHighlightColor properties. |
Q3DTheme::ColorStyleObjectGradient |
1 |
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 |
2 |
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. |
enum Q3DTheme::Theme▲
Built-in themes.
Constant |
Value |
Description |
---|---|---|
Q3DTheme::ThemeQt |
0 |
A light theme with green as the base color. |
Q3DTheme::ThemePrimaryColors |
1 |
A light theme with yellow as the base color. |
Q3DTheme::ThemeDigia |
2 |
A light theme with gray as the base color. |
Q3DTheme::ThemeStoneMoss |
3 |
A medium dark theme with yellow as the base color. |
Q3DTheme::ThemeArmyBlue |
4 |
A medium light theme with blue as the base color. |
Q3DTheme::ThemeRetro |
5 |
A medium light theme with brown as the base color. |
Q3DTheme::ThemeEbony |
6 |
A dark theme with white as the base color. |
Q3DTheme::ThemeIsabelle |
7 |
A dark theme with yellow as the base color. |
Q3DTheme::ThemeUserDefined |
8 |
A user-defined theme. For more information, see Default Theme. |
Property Documentation▲
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:
-
float ambientLightStrength() const
-
void setAmbientLightStrength(float strength)
Notifier signal:
-
void ambientLightStrengthChanged(float strength)
backgroundColor : QColor▲
This property holds the color of the graph background.
Access functions:
-
backgroundColor() const
-
void setBackgroundColor(const &color)
Notifier signal:
-
void backgroundColorChanged(const &color)
backgroundEnabled : bool▲
This property holds whether the background is visible.
The background is drawn by using the value of backgroundColor.
Access functions:
-
bool isBackgroundEnabled() const
-
void setBackgroundEnabled(bool enabled)
Notifier signal:
-
void backgroundEnabledChanged(bool enabled)
baseColors : QList<QColor>▲
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:
-
<> baseColors() const
-
void setBaseColors(const <> &colors)
Notifier signal:
-
void baseColorsChanged(const <> &colors)
baseGradients : QList<QLinearGradient>▲
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:
-
<> baseGradients() const
-
void setBaseGradients(const <> &gradients)
Notifier signal:
-
void baseGradientsChanged(const <> &gradients)
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:
-
colorStyle() const
-
void setColorStyle( style)
Notifier signal:
-
void colorStyleChanged( style)
font : QFont▲
This property holds the font to be used for labels.
Access functions:
-
font() const
-
void setFont(const &font)
Notifier signal:
-
void fontChanged(const &font)
gridEnabled : bool▲
This property holds whether the grid lines are drawn.
This value affects all grid lines.
Access functions:
-
bool isGridEnabled() const
-
void setGridEnabled(bool enabled)
Notifier signal:
-
void gridEnabledChanged(bool enabled)
gridLineColor : QColor▲
This property holds the color of the grid lines.
Access functions:
-
gridLineColor() const
-
void setGridLineColor(const &color)
Notifier signal:
-
void gridLineColorChanged(const &color)
highlightLightStrength : float▲
This property holds the specular light strength for selected objects.
The value must be between 0.0f and 10.0f.
Access functions:
-
float highlightLightStrength() const
-
void setHighlightLightStrength(float strength)
Notifier signal:
-
void highlightLightStrengthChanged(float strength)
labelBackgroundColor : QColor▲
This property holds the color of the label backgrounds.
Has no effect if labelBackgroundEnabled is false.
Access functions:
-
labelBackgroundColor() const
-
void setLabelBackgroundColor(const &color)
Notifier signal:
-
void labelBackgroundColorChanged(const &color)
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:
-
bool isLabelBackgroundEnabled() const
-
void setLabelBackgroundEnabled(bool enabled)
Notifier signal:
-
void labelBackgroundEnabledChanged(bool enabled)
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:
-
bool isLabelBorderEnabled() const
-
void setLabelBorderEnabled(bool enabled)
Notifier signal:
-
void labelBorderEnabledChanged(bool enabled)
labelTextColor : QColor▲
This property holds the color of the font used for labels.
Access functions:
-
labelTextColor() const
-
void setLabelTextColor(const &color)
Notifier signal:
-
void labelTextColorChanged(const &color)
lightColor : QColor▲
This property holds the color for the ambient and specular light.
This value affects the light specified in Q3DScene.
Access functions:
-
lightColor() const
-
void setLightColor(const &color)
Notifier signal:
-
void lightColorChanged(const &color)
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:
-
float lightStrength() const
-
void setLightStrength(float strength)
Notifier signal:
-
void lightStrengthChanged(float strength)
multiHighlightColor : QColor▲
This property holds the highlight color for selected objects.
Used if selectionMode has the QAbstract3DGraph::SelectionRow or QAbstract3DGraph::SelectionColumn flag set.
Access functions:
-
multiHighlightColor() const
-
void setMultiHighlightColor(const &color)
Notifier signal:
-
void multiHighlightColorChanged(const &color)
multiHighlightGradient : QLinearGradient▲
This property holds the highlight gradient for selected objects.
Used if selectionMode has the QAbstract3DGraph::SelectionRow or QAbstract3DGraph::SelectionColumn flag set.
Access functions:
-
multiHighlightGradient() const
-
void setMultiHighlightGradient(const &gradient)
Notifier signal:
-
void multiHighlightGradientChanged(const &gradient)
singleHighlightColor : QColor▲
This property holds the highlight color for a selected object.
Used if selectionMode has the QAbstract3DGraph::SelectionItem flag set.
Access functions:
-
singleHighlightColor() const
-
void setSingleHighlightColor(const &color)
Notifier signal:
-
void singleHighlightColorChanged(const &color)
singleHighlightGradient : QLinearGradient▲
This property holds the highlight gradient for a selected object.
Used if selectionMode has the QAbstract3DGraph::SelectionItem flag set.
Access functions:
-
singleHighlightGradient() const
-
void setSingleHighlightGradient(const &gradient)
Notifier signal:
-
void singleHighlightGradientChanged(const &gradient)
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:
-
type() const
-
void setType( themeType)
Notifier signal:
-
void typeChanged( themeType)
windowColor : QColor▲
This property holds the color of the application window the graph is drawn into.
Access functions:
-
windowColor() const
-
void setWindowColor(const &color)
Notifier signal:
-
void windowColorChanged(const &color)
Member Function Documentation▲
[explicit] Q3DTheme::Q3DTheme(QObject *parent = nullptr)▲
Constructs a new theme of type ThemeUserDefined. An optional parent parameter can be given and is then passed to QObject constructor.
[explicit] Q3DTheme::Q3DTheme(Q3DTheme::Theme themeType, QObject *parent = nullptr)▲
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.
[virtual] Q3DTheme::~Q3DTheme()▲
Destroys the theme.