Gui: move calls of OnChange to separate method

and explicitly call the class' method to fix warning about bypassing virtual dispatch during construction
This commit is contained in:
wmayer
2023-02-03 14:10:49 +01:00
committed by Uwe
parent 9906c63b32
commit d24bb7195a

View File

@@ -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)
{