QGraphsTheme Class
QGraphsTheme 클래스는 그래프에 대한 시각적 스타일을 제공합니다. 더 보기...
| 헤더: | #include <QGraphsTheme> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
| qmake: | QT += graphs |
| QML에서: | GraphsTheme |
| 상속: | QObject 그리고 QQmlParserStatus |
- 상속받은 멤버를 포함한 모든 멤버 목록
- QGraphsTheme는 Qt Graphs 의 C++ 공통 클래스에 속합니다.
공개 유형
| enum class | ColorScheme { Automatic, Light, Dark } |
| enum class | ColorStyle { Uniform, ObjectGradient, RangeGradient } |
| enum class | Theme { QtGreen, QtGreenNeon, MixSeries, OrangeSeries, YellowSeries, …, UserDefined } |
속성
|
|
공개 함수
| QGraphsLine | axisX() const |
| QFont | axisXLabelFont() const |
| QGraphsLine | axisY() const |
| QFont | axisYLabelFont() const |
| QGraphsLine | axisZ() const |
| QFont | axisZLabelFont() const |
| QColor | backgroundColor() const |
| QList<QColor> | borderColors() const |
| qreal | borderWidth() const |
| QGraphsTheme::ColorScheme | colorScheme() const |
| QGraphsTheme::ColorStyle | colorStyle() const |
| QGraphsLine | grid() const |
| bool | isBackgroundVisible() const |
| bool | isGridVisible() const |
| bool | isLabelBackgroundVisible() const |
| bool | isLabelBorderVisible() const |
| bool | isPlotAreaBackgroundVisible() const |
| QColor | labelBackgroundColor() const |
| QFont | labelFont() const |
| QColor | labelTextColor() const |
| bool | labelsVisible() const |
| QColor | multiHighlightColor() const |
| QColor | plotAreaBackgroundColor() const |
| QList<QColor> | seriesColors() const |
| QList<QLinearGradient> | seriesGradients() const |
| void | setAxisX(const QGraphsLine &newAxisX) |
| void | setAxisXLabelFont(const QFont &newAxisXLabelFont) |
| void | setAxisY(const QGraphsLine &newAxisY) |
| void | setAxisYLabelFont(const QFont &newAxisYLabelFont) |
| void | setAxisZ(const QGraphsLine &newAxisZ) |
| void | setAxisZLabelFont(const QFont &newAxisZLabelFont) |
| void | setBackgroundColor(QColor newBackgroundColor) |
| void | setBackgroundVisible(bool newBackgroundVisible) |
| void | setBorderColors(const QList<QColor> &newBorderColors) |
| void | setBorderWidth(qreal newBorderWidth) |
| void | setColorScheme(QGraphsTheme::ColorScheme newColorScheme) |
| void | setColorStyle(QGraphsTheme::ColorStyle newColorStyle) |
| void | setGrid(const QGraphsLine &newGrid) |
| void | setGridVisible(bool newGridVisibility) |
| void | setLabelBackgroundColor(QColor newLabelBackgroundColor) |
| void | setLabelBackgroundVisible(bool newLabelBackgroundVisibility) |
| void | setLabelBorderVisible(bool newLabelBorderVisibility) |
| void | setLabelFont(const QFont &newFont) |
| void | setLabelTextColor(QColor newLabelTextColor) |
| void | setLabelsVisible(bool newLabelsVisibility) |
| void | setMultiHighlightColor(QColor newMultiHighlightColor) |
| void | setPlotAreaBackgroundColor(QColor newBackgroundColor) |
| void | setPlotAreaBackgroundVisible(bool newBackgroundVisibility) |
| void | setSeriesColors(const QList<QColor> &newSeriesColors) |
| void | setSeriesGradients(const QList<QLinearGradient> &newSeriesGradients) |
| void | setSingleHighlightColor(QColor newSingleHighlightColor) |
| void | setTheme(QGraphsTheme::Theme newTheme, QGraphsTheme::ForceTheme force = ForceTheme::No) |
| QColor | singleHighlightColor() const |
| QGraphsTheme::Theme | theme() const |
신호
| void | axisXChanged() |
| void | axisXLabelFontChanged() |
| void | axisYChanged() |
| void | axisYLabelFontChanged() |
| void | axisZChanged() |
| void | axisZLabelFontChanged() |
| void | backgroundColorChanged() |
| void | backgroundVisibleChanged() |
| void | borderColorsChanged() |
| void | borderWidthChanged() |
| void | colorSchemeChanged() |
| void | colorStyleChanged(QGraphsTheme::ColorStyle type) |
| void | gridChanged() |
| void | gridVisibleChanged() |
| void | labelBackgroundColorChanged() |
| void | labelBackgroundVisibleChanged() |
| void | labelBorderVisibleChanged() |
| void | labelFontChanged() |
| void | labelTextColorChanged() |
| void | labelsVisibleChanged() |
| void | multiHighlightColorChanged(QColor color) |
| void | multiHighlightGradientQMLChanged() |
| void | plotAreaBackgroundColorChanged() |
| void | plotAreaBackgroundVisibleChanged() |
| void | seriesColorsChanged(const QList<QColor> &list) |
| void | singleHighlightColorChanged(QColor color) |
| void | singleHighlightGradientQMLChanged() |
| void | themeChanged(QGraphsTheme::Theme theme) |
상세 설명
그래프 전체에 영향을 미치는 시각적 속성을 지정합니다. 그대로 사용하거나 자유롭게 수정할 수 있는 여러 가지 기본 제공 테마가 있습니다.
UserDefined 열거형 값을 사용하여 테마를 처음부터 새로 만들 수 있습니다. 기본 생성자를 사용하여 테마를 생성하면 새로운 사용자 정의 테마가 생성됩니다.
테마 사용자 정의
기본 테마는 ` QtGreen`이지만, 각 속성을 사용자 정의할 수 있습니다.
다음 표에는 테마가 제어하는 속성과 ` UserDefined`의 기본값이 나열되어 있습니다.
| 속성 | 기본값 |
|---|---|
| backgroundVisible | true |
| seriesColors | Qt::black |
| seriesGradients | QLinearGradient. 본질적으로 완전히 검은색입니다. |
| colorStyle | Uniform |
| labelFont | QFont |
| gridVisible | true |
| labelBackgroundVisible | true |
| labelBorderVisible | true |
| labelsVisible | true |
사용 예
수정 없이 기본 제공 테마 생성하기:
QGraphsTheme *theme = new QGraphsTheme();내장 테마를 생성하고 일부 속성을 수정하는 방법:
QGraphsTheme *theme = new QGraphsTheme();
theme->setBackgroundVisible(false);
theme->setLabelBackgroundVisible(false);사용자 정의 테마 수정. 이 테마는 앞선 예제와 동일한 방식으로 생성되었습니다:
theme->setTheme(QGraphsTheme::Theme::UserDefined);
theme->setBackgroundColor(QColor(QRgb(0x99ca53)));
theme->setBackgroundVisible(true);
QList<QColor> colors = { QColor(QRgb(0x209fdf)) };
theme->setSeriesColors(colors);
theme->setColorStyle(QGraphsTheme::ColorStyle::Uniform);
theme->setLabelFont(QFont(QStringLiteral("Impact"), 35));
theme->setGridVisible(true);
auto gridline = theme->grid();
gridline.setMainColor(QColor(QRgb(0x99ca53)));
theme->setGrid(gridline);
theme->setLabelBackgroundColor(QColor(0xf6, 0xa6, 0x25, 0xa0));
theme->setLabelBackgroundVisible(true);
theme->setLabelBorderVisible(true);
theme->setLabelTextColor(QColor(QRgb(0x404044)));
theme->setMultiHighlightColor(QColor(QRgb(0x6d5fd5)));
theme->setSingleHighlightColor(QColor(QRgb(0xf6a625)));
theme->setBackgroundColor(QColor(QRgb(0xffffff)));그래프에 테마가 설정된 후 일부 속성을 수정하는 방법:
QQuickWidget quickWidget;
Q3DBarsWidgetItem bars;
bars.setWidget(&quickWidget);
bars.widget()->setMinimumSize(QSize(512, 512));
bars.activeTheme()->setTheme(QGraphsTheme::Theme::MixSeries);
QList<QColor> color = { QColor(Qt::red) };
bars.activeTheme()->setSeriesColors(color);
bars.activeTheme()->setSingleHighlightColor(Qt::yellow);멤버 유형 설명서
enum class QGraphsTheme::ColorScheme
그래프의 색상 구성을 나타냅니다.
| 상수 | 값 | 설명 |
|---|---|---|
QGraphsTheme::ColorScheme::Automatic | 0 | 배경색은 사용 가능한 경우 플랫폼 색상 구성표를 따릅니다. 사용 불가능한 경우 '밝은' 테마가 사용됩니다. |
QGraphsTheme::ColorScheme::Light | 1 | 배경색이 텍스트 색상보다 밝은 경우, 즉 테마가 밝은 테마인 경우입니다. |
QGraphsTheme::ColorScheme::Dark | 2 | 배경색이 텍스트 색상보다 어두우며, 즉 테마가 어두운 테마입니다. |
Qt::ColorScheme도 참조하십시오 .
enum class QGraphsTheme::ColorStyle
그라디언트 유형.
| 일정 | 값 | 설명 |
|---|---|---|
QGraphsTheme::ColorStyle::Uniform | 0 | 객체는 단일 색상으로 렌더링됩니다. 사용되는 색상은 seriesColors, singleHighlightColor 및 multiHighlightColor 속성에서 지정됩니다. |
QGraphsTheme::ColorStyle::ObjectGradient | 1 | 객체의 높이와 상관없이 각 객체마다 전체 그라데이션을 사용하여 색상이 지정됩니다. 사용되는 그라데이션은 seriesGradients, singleHighlightGradient 및 multiHighlightGradient 속성에서 지정됩니다. |
QGraphsTheme::ColorStyle::RangeGradient | 2 | 객체는 객체의 높이와 Y축상의 위치에 따라 결정된 전체 그라데이션의 일부를 사용하여 색상이 지정됩니다. 사용되는 그라데이션은 seriesGradients, singleHighlightGradient 및 multiHighlightGradient 속성에서 지정됩니다. |
enum class QGraphsTheme::Theme
기본 제공 테마.
| 상수 | 값 | 설명 |
|---|---|---|
QGraphsTheme::Theme::QtGreen | 0 | 기본 색상이 녹색인 밝은 테마. |
QGraphsTheme::Theme::QtGreenNeon | 1 | 네온 그린을 기본 색상으로 하는 밝은 테마입니다. |
QGraphsTheme::Theme::MixSeries | 2 | 다양한 색상이 혼합된 테마입니다. |
QGraphsTheme::Theme::OrangeSeries | 3 | 주 색상으로 주황색을 사용한 테마입니다. |
QGraphsTheme::Theme::YellowSeries | 4 | 노란색을 기본 색상으로 한 테마입니다. |
QGraphsTheme::Theme::BlueSeries | 5 | 파란색을 기본 색상으로 한 테마. |
QGraphsTheme::Theme::PurpleSeries | 6 | 보라색을 기본 색상으로 한 테마. |
QGraphsTheme::Theme::GreySeries | 7 | 회색을 기본 색상으로 하는 테마. |
QGraphsTheme::Theme::UserDefined | 8 | 사용자 정의 테마. 자세한 내용은 Customizing Theme 을 참조하십시오. |
속성 설명서
axisX : QGraphsLine
그래프의 X축 선 및 레이블 서식 속성.
액세스 함수:
| QGraphsLine | axisX() const |
| void | setAxisX(const QGraphsLine &newAxisX) |
알림 신호:
| void | axisXChanged() |
axisXLabelFont : QFont
이 속성은 x축의 레이블에 사용될 글꼴을 지정합니다.
액세스 함수:
| QFont | axisXLabelFont() const |
| void | setAxisXLabelFont(const QFont &newAxisXLabelFont) |
알림 신호:
| void | axisXLabelFontChanged() |
axisY : QGraphsLine
그래프의 Y축 선 및 레이블 서식 속성.
액세스 함수:
| QGraphsLine | axisY() const |
| void | setAxisY(const QGraphsLine &newAxisY) |
알림 신호:
| void | axisYChanged() |
axisYLabelFont : QFont
이 속성은 y축 레이블에 사용할 글꼴을 지정합니다.
액세스 함수:
| QFont | axisYLabelFont() const |
| void | setAxisYLabelFont(const QFont &newAxisYLabelFont) |
알림 신호:
| void | axisYLabelFontChanged() |
axisZ : QGraphsLine
그래프의 Z축 선 및 레이블 서식 속성.
액세스 함수:
| QGraphsLine | axisZ() const |
| void | setAxisZ(const QGraphsLine &newAxisZ) |
알림 신호:
| void | axisZChanged() |
axisZLabelFont : QFont
이 속성은 z축의 레이블에 사용될 글꼴을 지정합니다.
액세스 함수:
| QFont | axisZLabelFont() const |
| void | setAxisZLabelFont(const QFont &newAxisZLabelFont) |
알림 신호:
| void | axisZLabelFontChanged() |
backgroundColor : QColor
이 속성은 그래프가 그려지는 뷰의 색상을 지정합니다. 기본값은 ` colorScheme`에 따라 달라집니다.
액세스 함수:
| QColor | backgroundColor() const |
| void | setBackgroundColor(QColor newBackgroundColor) |
Notifier 신호:
| void | backgroundColorChanged() |
backgroundVisible : bool
이 속성은 배경이 표시되는지 여부를 결정합니다.
배경은 ` backgroundColor`의 값을 사용하여 그려집니다. 기본값은 ` true`입니다.
액세스 함수:
| bool | isBackgroundVisible() const |
| void | setBackgroundVisible(bool newBackgroundVisible) |
알림 신호:
| void | backgroundVisibleChanged() |
[read-only] baseColors : const QQmlListProperty<QQuickGraphsColor>
ColorStyle::Uniform 색상 스타일을 사용할 때 해당 시리즈에 적용될 기본 색상 목록입니다.
[read-only] baseGradients : const QQmlListProperty<QQuickGradient>
ColorStyle::RangeGradient 색상 스타일을 사용할 때 해당 시리즈에 적용될 기본 그라데이션 목록입니다.
borderColors : QList<QColor>
이 속성은 그래프 내의 모든 개체에 대해 시리즈별로 사용될 테두리 색상 목록을 포함합니다.
시리즈 수가 색상 수보다 많을 경우, 색상 목록은 순환하여 목록의 첫 번째 색상부터 다시 시작됩니다.
colorStyle 가 Uniform이 아닌 경우, 이 속성은 즉시 적용되지 않습니다.
액세스 함수:
| QList<QColor> | borderColors() const |
| void | setBorderColors(const QList<QColor> &newBorderColors) |
알림 신호:
| void | borderColorsChanged() |
borderWidth : qreal
이 속성은 그래프에 테두리가 있는 경우 그 너비를 지정합니다. 기본값은 1.0 입니다.
액세스 함수:
| qreal | borderWidth() const |
| void | setBorderWidth(qreal newBorderWidth) |
알림 신호:
| void | borderWidthChanged() |
colorScheme : QGraphsTheme::ColorScheme
현재 사용 중인 그래프의 색상 구성.
액세스 함수:
| QGraphsTheme::ColorScheme | colorScheme() const |
| void | setColorScheme(QGraphsTheme::ColorScheme newColorScheme) |
알림 신호:
| void | colorSchemeChanged() |
Qt::ColorScheme도 참조하십시오 .
colorStyle : QGraphsTheme::ColorStyle
그래프 색상의 스타일입니다. ` QGraphsTheme::ColorStyle ` 열거형 값 중 하나입니다.
이 값은 시리즈에서 Abstract3DSeries.colorStyle 을 명시적으로 설정하여 재정의할 수 있습니다.
참고: 이 속성은 2D의 Qt Graphs 에서는 적용되지 않습니다.
액세스 함수:
| QGraphsTheme::ColorStyle | colorStyle() const |
| void | setColorStyle(QGraphsTheme::ColorStyle newColorStyle) |
알림 신호:
| void | colorStyleChanged(QGraphsTheme::ColorStyle type) |
QGraphsTheme::ColorStyle도 참조하십시오 .
grid : QGraphsLine
그래프의 격자선 스타일 속성입니다.
액세스 함수:
| QGraphsLine | grid() const |
| void | setGrid(const QGraphsLine &newGrid) |
알림 신호:
| void | gridChanged() |
gridVisible : bool
이 속성은 격자선이 그려지는지 여부를 결정합니다.
이 값은 모든 격자선에 적용됩니다. 기본값은 ` true`입니다.
액세스 함수:
| bool | isGridVisible() const |
| void | setGridVisible(bool newGridVisibility) |
알림 신호:
| void | gridVisibleChanged() |
labelBackgroundColor : QColor
이 속성은 레이블 배경색을 지정합니다.
labelBackgroundVisible 가 false 인 경우 효과가 없습니다. 기본값은 colorScheme 에 따라 달라집니다.
액세스 함수:
| QColor | labelBackgroundColor() const |
| void | setLabelBackgroundColor(QColor newLabelBackgroundColor) |
알림 신호:
| void | labelBackgroundColorChanged() |
labelBackgroundVisible : bool
이 속성은 레이블이 색상 배경으로 그려지든 완전히 투명한 배경으로 그려지든 상관없이 적용됩니다.
labelBackgroundColor 값(알파 값 포함)이 배경을 그리는 데 사용됩니다.
배경이 있는 레이블은 가장 긴 레이블을 기준으로 축별로 동일한 크기로 그려지며, 텍스트는 레이블 중앙에 정렬됩니다. 배경이 없는 레이블은 있는 그대로 그려지며, 그래프 내 위치에 따라 왼쪽 또는 오른쪽으로 정렬됩니다. 기본값은 true 입니다.
액세스 함수:
| bool | isLabelBackgroundVisible() const |
| void | setLabelBackgroundVisible(bool newLabelBackgroundVisibility) |
알림 신호:
| void | labelBackgroundVisibleChanged() |
labelBorderVisible : bool
이 속성은 배경이 있는 레이블에 대해 레이블 테두리가 그려지는지 여부를 결정합니다.
labelBackgroundVisible 가 false 인 경우에는 효과가 없습니다. 기본값은 true 입니다.
액세스 함수:
| bool | isLabelBorderVisible() const |
| void | setLabelBorderVisible(bool newLabelBorderVisibility) |
알림 신호:
| void | labelBorderVisibleChanged() |
labelFont : QFont
이 속성은 레이블에 사용할 글꼴을 지정합니다.
액세스 함수:
| QFont | labelFont() const |
| void | setLabelFont(const QFont &newFont) |
알림 신호:
| void | labelFontChanged() |
labelTextColor : QColor
이 속성은 레이블에 사용되는 글꼴의 색상을 지정합니다.
축에 labelTextColor 가 명시적으로 지정된 경우, 이 속성은 적용되지 않습니다.
기본값은 colorScheme 에 따라 달라집니다.
액세스 함수:
| QColor | labelTextColor() const |
| void | setLabelTextColor(QColor newLabelTextColor) |
알림 신호:
| void | labelTextColorChanged() |
labelsVisible : bool
이 속성은 레이블이 그려지는지 여부를 결정합니다.
이 속성이 ` false`인 경우, 다른 모든 레이블 속성은 적용되지 않습니다. 기본값은 ` true`입니다.
액세스 함수:
| bool | labelsVisible() const |
| void | setLabelsVisible(bool newLabelsVisibility) |
알림 신호:
| void | labelsVisibleChanged() |
multiHighlightColor : QColor
이 속성은 선택된 객체의 강조 표시 색상을 저장합니다.
selectionMode 에 QtGraphs3D::SelectionFlag::Row 또는 QtGraphs3D::SelectionFlag::Column 플래그가 설정된 경우 사용됩니다. 기본값은 colorScheme 에 따라 달라집니다.
액세스 함수:
| QColor | multiHighlightColor() const |
| void | setMultiHighlightColor(QColor newMultiHighlightColor) |
알림 신호:
| void | multiHighlightColorChanged(QColor color) |
multiHighlightGradient : QQuickGradient*
이 속성은 선택된 객체의 하이라이트 그라데이션을 저장합니다.
selectionMode 에 ' QtGraphs3D::SelectionFlag::Row ' 또는 ' QtGraphs3D::SelectionFlag::Column ' 플래그가 설정된 경우 사용됩니다. 기본값은 colorScheme 에 따라 달라집니다.
알림 신호:
| void | multiHighlightGradientQMLChanged() |
plotAreaBackgroundColor : QColor
이 속성은 그래프 플롯 영역의 배경색을 지정합니다. 기본값은 ` colorScheme`에 따라 달라집니다.
액세스 함수:
| QColor | plotAreaBackgroundColor() const |
| void | setPlotAreaBackgroundColor(QColor newBackgroundColor) |
알림 신호:
| void | plotAreaBackgroundColorChanged() |
plotAreaBackgroundVisible : bool
이 속성은 플롯 영역의 배경이 표시되는지 여부를 결정합니다.
배경은 ` plotAreaBackgroundColor`의 값을 사용하여 그려집니다. 기본값은 ` true`입니다.
액세스 함수:
| bool | isPlotAreaBackgroundVisible() const |
| void | setPlotAreaBackgroundVisible(bool newBackgroundVisibility) |
알림 신호:
| void | plotAreaBackgroundVisibleChanged() |
seriesColors : QList<QColor>
이 속성은 그래프 내의 모든 개체에 사용될 기본 색상 목록을 시리즈별로 저장합니다.
시리즈 수가 색상 수보다 많을 경우, 색상 목록은 순환하여 목록의 첫 번째 색상부터 다시 시작됩니다.
colorStyle 가 Uniform이 아닌 경우, 이 속성은 즉시 적용되지 않습니다.
시리즈에서 ` baseColor `를 명시적으로 설정하면 이 값을 재정의할 수 있습니다.
액세스 함수:
| QList<QColor> | seriesColors() const |
| void | setSeriesColors(const QList<QColor> &newSeriesColors) |
알림 신호:
| void | seriesColorsChanged(const QList<QColor> &list) |
singleHighlightColor : QColor
이 속성은 선택된 객체의 강조 표시 색상을 저장합니다.
selectionMode 에 QtGraphs3D::SelectionFlag::Item 플래그가 설정된 경우 사용됩니다. 기본값은 colorScheme 에 따라 달라집니다.
액세스 함수:
| QColor | singleHighlightColor() const |
| void | setSingleHighlightColor(QColor newSingleHighlightColor) |
알림 신호:
| void | singleHighlightColorChanged(QColor color) |
singleHighlightGradient : QQuickGradient*
이 속성은 선택된 객체의 하이라이트 그라데이션을 저장합니다.
selectionMode 에 ' QtGraphs3D::SelectionFlag::Item ' 플래그가 설정된 경우 사용됩니다. 기본값은 colorScheme 에 따라 달라집니다.
알림 신호:
| void | singleHighlightGradientQMLChanged() |
theme : QGraphsTheme::Theme
테마의 유형입니다. 유형이 설정되지 않은 경우, 유형은 ` GraphsTheme.Theme.QtGreen`입니다. 항목이 생성된 후 테마 유형을 변경하면 테마의 다른 모든 속성이 미리 정의된 테마에서 지정한 값으로 변경됩니다. 그래프의 활성 테마 유형을 변경하면 연결된 모든 시리즈가 새 테마를 사용하도록 재설정됩니다.
액세스 함수:
| QGraphsTheme::Theme | theme() const |
| void | setTheme(QGraphsTheme::Theme newTheme, QGraphsTheme::ForceTheme force = ForceTheme::No) |
알림 신호:
| void | themeChanged(QGraphsTheme::Theme theme) |
[read-only] themeChildren : const QQmlListProperty<QObject>
테마 자식 객체 목록입니다. 이 속성은 QML의 Theme 요소 내에서 children 속성 이름을 명시적으로 사용하지 않고도 자식 객체를 지정할 수 있게 해주는 기본 속성입니다.
멤버 함수 문서
QList<QLinearGradient> QGraphsTheme::seriesGradients() const
테마에서 사용하는 시리즈 그라데이션 목록을 반환합니다.
setSeriesGradients()도 참조하십시오 .
void QGraphsTheme::setSeriesGradients(const QList<QLinearGradient> &newSeriesGradients)
newSeriesGradients 를 테마의 시리즈 그라데이션으로 설정합니다.
seriesGradients()도 참조하십시오 .
© 2026 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.