diff options
author | Kwanghyo Park <kwanghyo.park@qt.io> | 2024-05-08 14:45:36 +0300 |
---|---|---|
committer | Kwanghyo Park <kwanghyo.park@qt.io> | 2024-05-10 19:48:42 +0300 |
commit | 97c160a512bfd0384adecb9ad049f4a38c667160 (patch) | |
tree | 0146d4012bbfb16b6d0ce6fcaf195f872c72fb42 | |
parent | 024e7d777ab09aab462e8f49bf8c348b1973b41c (diff) |
Update label text color for 3D graph
When label text color changes, updates the color
Change-Id: I03073c44b1bc7850e0f494d960493d9caeecb63f
Reviewed-by: Sakaria Pouke <sakaria.pouke@qt.io>
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
Reviewed-by: Sami Varanka <sami.varanka@qt.io>
-rw-r--r-- | src/graphs3d/qml/qquickgraphsitem.cpp | 45 | ||||
-rw-r--r-- | tests/manual/qmltheme/qml/qmltheme/BackgroundModifiers.qml | 33 |
2 files changed, 66 insertions, 12 deletions
diff --git a/src/graphs3d/qml/qquickgraphsitem.cpp b/src/graphs3d/qml/qquickgraphsitem.cpp index 6d27944..12bfc7a 100644 --- a/src/graphs3d/qml/qquickgraphsitem.cpp +++ b/src/graphs3d/qml/qquickgraphsitem.cpp @@ -1982,25 +1982,46 @@ void QQuickGraphsItem::synchData() if (theme()->dirtyBits()->labelTextColorDirty) { QColor labelTextColor = theme()->labelTextColor(); - changeLabelTextColor(m_repeaterX, theme()->axisXLabelColor()); - changeLabelTextColor(m_repeaterY, theme()->axisYLabelColor()); - changeLabelTextColor(m_repeaterZ, theme()->axisZLabelColor()); - m_titleLabelX->setProperty("labelTextColor", theme()->axisXLabelColor()); - m_titleLabelY->setProperty("labelTextColor", theme()->axisYLabelColor()); - m_titleLabelZ->setProperty("labelTextColor", theme()->axisZLabelColor()); m_itemLabel->setProperty("labelTextColor", labelTextColor); + if (m_sliceView && isSliceEnabled()) + m_sliceItemLabel->setProperty("labelTextColor", labelTextColor); + theme()->dirtyBits()->labelTextColorDirty = false; + } + + if (theme()->dirtyBits()->axisXLabelColorDirty) { + QColor labelTextColor = theme()->axisXLabelColor(); + changeLabelTextColor(m_repeaterX, labelTextColor); + m_titleLabelX->setProperty("labelTextColor", labelTextColor); if (m_sliceView && isSliceEnabled()) { if (m_selectionMode == SelectionRow) - changeLabelTextColor(m_sliceHorizontalLabelRepeater, theme()->axisXLabelColor()); - else - changeLabelTextColor(m_sliceHorizontalLabelRepeater, theme()->axisZLabelColor()); - changeLabelTextColor(m_sliceVerticalLabelRepeater, theme()->axisYLabelColor()); - m_sliceItemLabel->setProperty("labelTextColor", labelTextColor); + changeLabelTextColor(m_sliceHorizontalLabelRepeater, labelTextColor); m_sliceHorizontalTitleLabel->setProperty("labelTextColor", labelTextColor); + } + theme()->dirtyBits()->axisXLabelColorDirty = false; + } + + if (theme()->dirtyBits()->axisYLabelColorDirty) { + QColor labelTextColor = theme()->axisYLabelColor(); + changeLabelTextColor(m_repeaterY, theme()->axisYLabelColor()); + m_titleLabelY->setProperty("labelTextColor", theme()->axisYLabelColor()); + if (m_sliceView && isSliceEnabled()) { + changeLabelTextColor(m_sliceVerticalLabelRepeater, theme()->axisYLabelColor()); m_sliceVerticalTitleLabel->setProperty("labelTextColor", labelTextColor); } - theme()->dirtyBits()->labelTextColorDirty = false; + theme()->dirtyBits()->axisYLabelColorDirty = false; + } + + if (theme()->dirtyBits()->axisZLabelColorDirty) { + QColor labelTextColor = theme()->axisZLabelColor(); + changeLabelTextColor(m_repeaterZ, theme()->axisZLabelColor()); + m_titleLabelZ->setProperty("labelTextColor", theme()->axisZLabelColor()); + if (m_sliceView && isSliceEnabled()) { + if (m_selectionMode == SelectionColumn) + changeLabelTextColor(m_sliceHorizontalLabelRepeater, theme()->axisZLabelColor()); + m_sliceHorizontalTitleLabel->setProperty("labelTextColor", labelTextColor); + } + theme()->dirtyBits()->axisZLabelColorDirty = false; } if (theme()->dirtyBits()->labelFontDirty) { diff --git a/tests/manual/qmltheme/qml/qmltheme/BackgroundModifiers.qml b/tests/manual/qmltheme/qml/qmltheme/BackgroundModifiers.qml index ab9e559..bc348ed 100644 --- a/tests/manual/qmltheme/qml/qmltheme/BackgroundModifiers.qml +++ b/tests/manual/qmltheme/qml/qmltheme/BackgroundModifiers.qml @@ -148,6 +148,12 @@ ColumnLayout { } } + ColorDialog { + id: labelTextCol + selectedColor: customTheme.labelTextColor + onAccepted: customTheme.labelTextColor = selectedColor + } + Label { text: "Label Border" color: "gray" @@ -158,4 +164,31 @@ ColumnLayout { customTheme.labelBorderEnabled = checked } } + + Label { + text: "Axis label text color" + color: "gray" + } + Button { + Layout.preferredHeight: 25 + Layout.preferredWidth: 25 + + Rectangle { + anchors.fill: parent + anchors.margins: 5 + color: customTheme.axisXLabelColor + } + + onClicked: axisLabelTextCol.open() + } + + ColorDialog { + id: axisLabelTextCol + selectedColor: customTheme.axisXLabelColor + onAccepted: { + customTheme.axisXLabelColor = selectedColor + customTheme.axisYLabelColor = selectedColor + customTheme.axisZLabelColor = selectedColor + } + } } |