QGraphsTheme Class
QGraphsTheme 클래스는 그래프에 대한 시각적 스타일을 제공합니다. 더 보기...
Header: | #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 을 참조하십시오. |
속성 문서
axisXLabelFont : QFont
이 속성에는 x축의 레이블에 사용할 글꼴이 저장됩니다.
함수에 액세스합니다:
QFont | axisXLabelFont() const |
void | setAxisXLabelFont(const QFont &newAxisXLabelFont) |
알림 신호:
void | axisXLabelFontChanged() |
axisYLabelFont : QFont
이 속성은 Y축의 레이블에 사용할 글꼴을 저장합니다.
함수에 액세스합니다:
QFont | axisYLabelFont() const |
void | setAxisYLabelFont(const QFont &newAxisYLabelFont) |
알림 신호:
void | axisYLabelFontChanged() |
axisZLabelFont : QFont
이 속성에는 Z축의 레이블에 사용할 글꼴이 저장됩니다.
함수에 액세스합니다:
QFont | axisZLabelFont() const |
void | setAxisZLabelFont(const QFont &newAxisZLabelFont) |
알림 신호:
void | axisZLabelFontChanged() |
backgroundColor : QColor
이 속성은 그래프가 그려지는 뷰의 색상을 유지합니다. 기본값은 colorScheme 에 따라 달라집니다.
함수에 액세스합니다:
QColor | backgroundColor() const |
void | setBackgroundColor(QColor newBackgroundColor) |
알림 신호:
void | backgroundColorChanged() |
backgroundVisible : bool
이 속성은 배경이 표시되는지 여부를 보유합니다.
배경은 backgroundColor 값을 사용하여 그려집니다. 기본값은 true
입니다.
함수에 액세스합니다:
bool | isBackgroundVisible() const |
void | setBackgroundVisible(bool newBackgroundVisible) |
알림 신호:
void | backgroundVisibleChanged() |
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 를참조하세요 .
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* const
이 속성은 선택된 객체의 하이라이트 그라데이션을 유지합니다.
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* const
이 속성은 선택한 객체에 대한 강조 그라데이션을 저장합니다.
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) |
멤버 함수 문서
QList<QLinearGradient> QGraphsTheme::seriesGradients() const
테마별로 사용된 계열 그라데이션 목록을 반환합니다.
setSeriesGradients()도 참조하세요 .
void QGraphsTheme::setSeriesGradients(const QList<QLinearGradient> &newSeriesGradients)
newSeriesGradients 을 테마의 시리즈 그라데이션으로 설정합니다.
seriesGradients()도 참조하세요 .
© 2025 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.