From 076ab800ffa4c651a565354925a0ecdb2ecddbb7 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sun, 23 Feb 2025 15:04:34 +0100 Subject: [PATCH] Gui: SoFrameLabel text color from base color support This adds support for obtaining text color from the state of the graph (base color) to SoFrameLabel nodes. --- src/Gui/SoTextLabel.cpp | 10 ++++++++++ src/Gui/SoTextLabel.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/Gui/SoTextLabel.cpp b/src/Gui/SoTextLabel.cpp index 1a4a29c0aa..a08cc645d3 100644 --- a/src/Gui/SoTextLabel.cpp +++ b/src/Gui/SoTextLabel.cpp @@ -381,6 +381,7 @@ SoFrameLabel::SoFrameLabel() SO_NODE_ADD_FIELD(frame, (true)); SO_NODE_ADD_FIELD(border, (true)); SO_NODE_ADD_FIELD(backgroundUseBaseColor, (false)); + SO_NODE_ADD_FIELD(textUseBaseColor, (false)); //SO_NODE_ADD_FIELD(image, (SbVec2s(0,0), 0, NULL)); } @@ -508,6 +509,15 @@ void SoFrameLabel::GLRender(SoGLRenderAction *action) } } + if (textUseBaseColor.getValue()) { + SoState* state = action->getState(); + const SbColor& diffuse = SoLazyElement::getDiffuse(state, 0); + + if (diffuse != this->textColor.getValue()) { + this->textColor.setValue(diffuse); + } + } + inherited::GLRender(action); } diff --git a/src/Gui/SoTextLabel.h b/src/Gui/SoTextLabel.h index 56b9726711..d2dcf43b91 100644 --- a/src/Gui/SoTextLabel.h +++ b/src/Gui/SoTextLabel.h @@ -120,6 +120,7 @@ public: SoSFBool frame; SoSFBool border; SoSFBool backgroundUseBaseColor; + SoSFBool textUseBaseColor; //SoSFImage image; QPixmap iconPixmap;