From d24bb7195ad69c39bcf9bd883c851127c3cce5d1 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 3 Feb 2023 14:10:49 +0100 Subject: [PATCH] Gui: move calls of OnChange to separate method and explicitly call the class' method to fix warning about bypassing virtual dispatch during construction --- src/Gui/NaviCube.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 0d4b4ff4f6..393a0f2d04 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -118,6 +118,7 @@ public: /// Observer message from the ParameterGrp void OnChange(ParameterGrp::SubjectType& rCaller, ParameterGrp::MessageType Reason) override; + void applySettings(ParameterGrp&); bool processSoEvent(const SoEvent* ev); @@ -329,18 +330,7 @@ NaviCubeImplementation::NaviCubeImplementation( "User parameter:BaseApp/Preferences/NaviCube"); hGrp->Attach(this); - OnChange(*hGrp, "TextColor"); - OnChange(*hGrp, "FrontColor"); - OnChange(*hGrp, "HiliteColor"); - OnChange(*hGrp, "ButtonColor"); - OnChange(*hGrp, "CornerNaviCube"); - OnChange(*hGrp, "CubeSize"); - OnChange(*hGrp, "NaviRotateToNearest"); - OnChange(*hGrp, "NaviStepByTurn"); - OnChange(*hGrp, "BorderWidth"); - OnChange(*hGrp, "BorderColor"); - OnChange(*hGrp, "FontSize"); - OnChange(*hGrp, "FontString"); + applySettings(*hGrp); m_PickingFramebuffer = nullptr; m_Menu = createNaviCubeMenu(); @@ -366,6 +356,22 @@ int NaviCubeImplementation::getDefaultFontSize() return int(0.18 * texSize); } +void NaviCubeImplementation::applySettings(ParameterGrp& rGrp) +{ + NaviCubeImplementation::OnChange(rGrp, "TextColor"); + NaviCubeImplementation::OnChange(rGrp, "FrontColor"); + NaviCubeImplementation::OnChange(rGrp, "HiliteColor"); + NaviCubeImplementation::OnChange(rGrp, "ButtonColor"); + NaviCubeImplementation::OnChange(rGrp, "CornerNaviCube"); + NaviCubeImplementation::OnChange(rGrp, "CubeSize"); + NaviCubeImplementation::OnChange(rGrp, "NaviRotateToNearest"); + NaviCubeImplementation::OnChange(rGrp, "NaviStepByTurn"); + NaviCubeImplementation::OnChange(rGrp, "BorderWidth"); + NaviCubeImplementation::OnChange(rGrp, "BorderColor"); + NaviCubeImplementation::OnChange(rGrp, "FontSize"); + NaviCubeImplementation::OnChange(rGrp, "FontString"); +} + void NaviCubeImplementation::OnChange(ParameterGrp::SubjectType& rCaller, ParameterGrp::MessageType reason) {