Q3DTheme class provides a visual style for graphs. 更多...
| 頭: | #include <Q3DTheme> |
| Since: | QtDataVisualization 1.0 |
| 實例化: | Theme3D |
| 繼承: | QObject |
| enum | ColorStyle { ColorStyleUniform, ColorStyleObjectGradient, ColorStyleRangeGradient } |
| enum | Theme { ThemeQt, ThemePrimaryColors, ThemeDigia, ThemeStoneMoss, ..., ThemeUserDefined } |
|
|
| Q3DTheme (QObject * parent = nullptr) | |
| Q3DTheme (Q3DTheme::Theme themeType , QObject * parent = nullptr) | |
| virtual | ~Q3DTheme () |
| float | ambientLightStrength () const |
| QColor | backgroundColor () const |
| QList<QColor> | baseColors () const |
| QList<QLinearGradient> | baseGradients () const |
| Q3DTheme::ColorStyle | colorStyle () const |
| QFont | font () const |
| QColor | gridLineColor () const |
| float | highlightLightStrength () const |
| bool | isBackgroundEnabled () const |
| bool | isGridEnabled () const |
| bool | isLabelBackgroundEnabled () const |
| bool | isLabelBorderEnabled () const |
| QColor | labelBackgroundColor () const |
| QColor | labelTextColor () const |
| QColor | lightColor () const |
| float | lightStrength () const |
| QColor | multiHighlightColor () const |
| QLinearGradient | multiHighlightGradient () const |
| void | setAmbientLightStrength (float strength ) |
| void | setBackgroundColor (const QColor & color ) |
| void | setBackgroundEnabled (bool enabled ) |
| void | setBaseColors (const QList<QColor> & colors ) |
| void | setBaseGradients (const QList<QLinearGradient> & gradients ) |
| void | setColorStyle (Q3DTheme::ColorStyle style ) |
| void | setFont (const QFont & font ) |
| void | setGridEnabled (bool enabled ) |
| void | setGridLineColor (const QColor & color ) |
| void | setHighlightLightStrength (float strength ) |
| void | setLabelBackgroundColor (const QColor & color ) |
| void | setLabelBackgroundEnabled (bool enabled ) |
| void | setLabelBorderEnabled (bool enabled ) |
| void | setLabelTextColor (const QColor & color ) |
| void | setLightColor (const QColor & color ) |
| void | setLightStrength (float strength ) |
| void | setMultiHighlightColor (const QColor & color ) |
| void | setMultiHighlightGradient (const QLinearGradient & gradient ) |
| void | setSingleHighlightColor (const QColor & color ) |
| void | setSingleHighlightGradient (const QLinearGradient & gradient ) |
| void | setType (Q3DTheme::Theme themeType ) |
| void | setWindowColor (const QColor & color ) |
| QColor | singleHighlightColor () const |
| QLinearGradient | singleHighlightGradient () const |
| Q3DTheme::Theme | type () const |
| QColor | windowColor () const |
| void | ambientLightStrengthChanged (float strength ) |
| void | backgroundColorChanged (const QColor & color ) |
| void | backgroundEnabledChanged (bool enabled ) |
| void | baseColorsChanged (const QList<QColor> & colors ) |
| void | baseGradientsChanged (const QList<QLinearGradient> & gradients ) |
| void | colorStyleChanged (Q3DTheme::ColorStyle style ) |
| void | fontChanged (const QFont & font ) |
| void | gridEnabledChanged (bool enabled ) |
| void | gridLineColorChanged (const QColor & color ) |
| void | highlightLightStrengthChanged (float strength ) |
| void | labelBackgroundColorChanged (const QColor & color ) |
| void | labelBackgroundEnabledChanged (bool enabled ) |
| void | labelBorderEnabledChanged (bool enabled ) |
| void | labelTextColorChanged (const QColor & color ) |
| void | lightColorChanged (const QColor & color ) |
| void | lightStrengthChanged (float strength ) |
| void | multiHighlightColorChanged (const QColor & color ) |
| void | multiHighlightGradientChanged (const QLinearGradient & gradient ) |
| void | singleHighlightColorChanged (const QColor & color ) |
| void | singleHighlightGradientChanged (const QLinearGradient & gradient ) |
| void | typeChanged (Q3DTheme::Theme themeType ) |
| void | windowColorChanged (const QColor & color ) |
| const QMetaObject | staticMetaObject |
| QScopedPointer<Q3DThemePrivate> | d_ptr |
Q3DTheme class provides a visual style for graphs.
指定影響整個圖形的視覺特性。有幾個內置主題可以使用或自由修改。
可以覆寫以下特性通過使用 QAbstract3DSeries 特性以按係列明確設置它們: baseColors , baseGradients ,和 colorStyle .
可以從新創建主題使用 ThemeUserDefined 枚舉值。使用默認構造函數創建主題會産生新的用戶定義主題。
The following table lists the properties controlled by themes and the default values for ThemeUserDefined .
創建內置主題不做任何修改:
Q3DTheme *theme = new Q3DTheme(Q3DTheme::ThemeQt);
創建內置主題並修改一些特性:
Q3DTheme *theme = new Q3DTheme(Q3DTheme::ThemeQt); theme->setBackgroundEnabled(false); theme->setLabelBackgroundEnabled(false);
創建用戶定義主題:
Q3DTheme *theme = new 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)));
創建內置主題並在設置後修改一些特性:
Q3DBars *graph = new Q3DBars(); graph->activeTheme()->setType(Q3DTheme::ThemePrimaryColors); graph->activeTheme()->setBaseColor(Qt::red); graph->activeTheme()->setSingleHighlightColor(Qt::yellow);
顔色樣式。
| 常量 | 值 | 描述 |
|---|---|---|
Q3DTheme::ColorStyleUniform
|
0
|
Objects are rendered in a single color. The color used is specified in baseColors , singleHighlightColor and multiHighlightColor 特性。 |
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 特性。 |
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 特性。 |
內置主題。
| 常量 | 值 | 描述 |
|---|---|---|
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 默認主題 . |
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.
值必須介於
0.0f
and
1.0f
.
訪問函數:
| float | ambientLightStrength () const |
| void | setAmbientLightStrength (float strength ) |
通知程序信號:
| void | ambientLightStrengthChanged (float strength ) |
此特性保持圖形背景的顔色。
訪問函數:
| QColor | backgroundColor () const |
| void | setBackgroundColor (const QColor & color ) |
通知程序信號:
| void | backgroundColorChanged (const QColor & color ) |
此特性保持背景是否可見。
The background is drawn by using the value of backgroundColor .
訪問函數:
| bool | isBackgroundEnabled () const |
| void | setBackgroundEnabled (bool enabled ) |
通知程序信號:
| void | backgroundEnabledChanged (bool enabled ) |
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 不是 ColorStyleUniform .
This value can be overridden by setting the baseColor explicitly in the series.
訪問函數:
| QList<QColor> | baseColors () const |
| void | setBaseColors (const QList<QColor> & colors ) |
通知程序信號:
| void | baseColorsChanged (const QList<QColor> & colors ) |
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.
訪問函數:
| QList<QLinearGradient> | baseGradients () const |
| void | setBaseGradients (const QList<QLinearGradient> & gradients ) |
通知程序信號:
| void | baseGradientsChanged (const QList<QLinearGradient> & gradients ) |
此特性保持圖形顔色的樣式。
One of the ColorStyle 枚舉值。
This value can be overridden by setting colorStyle explicitly in the series.
訪問函數:
| Q3DTheme::ColorStyle | colorStyle () const |
| void | setColorStyle (Q3DTheme::ColorStyle style ) |
通知程序信號:
| void | colorStyleChanged (Q3DTheme::ColorStyle style ) |
此特性保持用於標簽的字體。
訪問函數:
| QFont | font () const |
| void | setFont (const QFont & font ) |
通知程序信號:
| void | fontChanged (const QFont & font ) |
此特性保持是否繪製柵格綫。
此值影響所有柵格綫。
訪問函數:
| bool | isGridEnabled () const |
| void | setGridEnabled (bool enabled ) |
通知程序信號:
| void | gridEnabledChanged (bool enabled ) |
此特性保持柵格綫的顔色。
訪問函數:
| QColor | gridLineColor () const |
| void | setGridLineColor (const QColor & color ) |
通知程序信號:
| void | gridLineColorChanged (const QColor & color ) |
此特性保持用於選中對象的鏡麵光強度。
值必須介於
0.0f
and
10.0f
.
訪問函數:
| float | highlightLightStrength () const |
| void | setHighlightLightStrength (float strength ) |
通知程序信號:
| void | highlightLightStrengthChanged (float strength ) |
此特性保持標簽背景的顔色。
不起作用若
labelBackgroundEnabled
is
false
.
訪問函數:
| QColor | labelBackgroundColor () const |
| void | setLabelBackgroundColor (const QColor & color ) |
通知程序信號:
| void | labelBackgroundColorChanged (const QColor & color ) |
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.
訪問函數:
| bool | isLabelBackgroundEnabled () const |
| void | setLabelBackgroundEnabled (bool enabled ) |
通知程序信號:
| void | labelBackgroundEnabledChanged (bool enabled ) |
此特性保持是否為擁有背景的標簽繪製標簽邊框。
不起作用若
labelBackgroundEnabled
is
false
.
訪問函數:
| bool | isLabelBorderEnabled () const |
| void | setLabelBorderEnabled (bool enabled ) |
通知程序信號:
| void | labelBorderEnabledChanged (bool enabled ) |
此特性保持用於標簽的字體顔色。
訪問函數:
| QColor | labelTextColor () const |
| void | setLabelTextColor (const QColor & color ) |
通知程序信號:
| void | labelTextColorChanged (const QColor & color ) |
This property holds the color for the ambient and specular light.
This value affects the light specified in Q3DScene .
訪問函數:
| QColor | lightColor () const |
| void | setLightColor (const QColor & color ) |
通知程序信號:
| void | lightColorChanged (const QColor & color ) |
This property holds the specular light strength for the whole graph.
值必須介於
0.0f
and
10.0f
.
This value affects the light specified in Q3DScene .
訪問函數:
| float | lightStrength () const |
| void | setLightStrength (float strength ) |
通知程序信號:
| void | lightStrengthChanged (float strength ) |
This property holds the highlight color for selected objects.
Used if
selectionMode
擁有
QAbstract3DGraph::SelectionRow
or
QAbstract3DGraph::SelectionColumn
設置標誌。
訪問函數:
| QColor | multiHighlightColor () const |
| void | setMultiHighlightColor (const QColor & color ) |
通知程序信號:
| void | multiHighlightColorChanged (const QColor & color ) |
This property holds the highlight gradient for selected objects.
Used if
selectionMode
擁有
QAbstract3DGraph::SelectionRow
or
QAbstract3DGraph::SelectionColumn
設置標誌。
訪問函數:
| QLinearGradient | multiHighlightGradient () const |
| void | setMultiHighlightGradient (const QLinearGradient & gradient ) |
通知程序信號:
| void | multiHighlightGradientChanged (const QLinearGradient & gradient ) |
This property holds the highlight color for a selected object.
Used if
selectionMode
擁有
QAbstract3DGraph::SelectionItem
設置標誌。
訪問函數:
| QColor | singleHighlightColor () const |
| void | setSingleHighlightColor (const QColor & color ) |
通知程序信號:
| void | singleHighlightColorChanged (const QColor & color ) |
This property holds the highlight gradient for a selected object.
Used if
selectionMode
擁有
QAbstract3DGraph::SelectionItem
設置標誌。
訪問函數:
| QLinearGradient | singleHighlightGradient () const |
| void | setSingleHighlightGradient (const QLinearGradient & gradient ) |
通知程序信號:
| void | singleHighlightGradientChanged (const QLinearGradient & gradient ) |
此特性保持主題的類型。
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.
訪問函數:
| Q3DTheme::Theme | type () const |
| void | setType (Q3DTheme::Theme themeType ) |
通知程序信號:
| void | typeChanged (Q3DTheme::Theme themeType ) |
This property holds the color of the application window the graph is drawn into.
訪問函數:
| QColor | windowColor () const |
| void | setWindowColor (const QColor & color ) |
通知程序信號:
| void | windowColorChanged (const QColor & color ) |
構造新主題為類型 ThemeUserDefined 。可選 parent 參數可以給齣,然後會被傳遞給 QObject 構造函數。
構造新的主題采用 themeType ,可以是某一內置主題來自 Theme 。可選 parent 參數可以給齣,然後會被傳遞給 QObject 構造函數。
[虛擬]
Q3DTheme::
~Q3DTheme
()
銷毀主題。