#51 Add preference option to control legend background

This commit is contained in:
Jacob Støren 2018-03-08 16:15:45 +01:00
parent b4935a0534
commit 4d7f753d3c
4 changed files with 14 additions and 0 deletions

View File

@ -77,6 +77,8 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&includeFractureDebugInfoFile, "includeFractureDebugInfoFile", false, "Include Fracture Debug Info for Completion Export", "", "", "");
includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&showLegendBackground, "showLegendBackground", true, "Enable Legend Background", "", "", "");
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.uiCapability()->setUiHidden(true);
@ -153,6 +155,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
defaultSettingsGroup->add(&defaultWellLabelColor);
defaultSettingsGroup->add(&fontSizeInScene);
defaultSettingsGroup->add(&defaultScaleFactorZ);
defaultSettingsGroup->add(&showLegendBackground);
caf::PdmUiGroup* viewsGroup = uiOrdering.addNewGroup("3D Views");
viewsGroup->add(&navigationPolicy);

View File

@ -63,6 +63,7 @@ public: // Pdm Fields
caf::PdmField<cvf::Color3f> defaultWellLabelColor;
caf::PdmField<bool> showLasCurveWithoutTvdWarning;
caf::PdmField<QString> fontSizeInScene;
caf::PdmField<bool> showLegendBackground;
caf::PdmField<bool> useShaders;
caf::PdmField<bool> showHud;

View File

@ -48,6 +48,7 @@
#include <cmath>
#include "RimIntersectionCollection.h"
#include "RiaPreferences.h"
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
@ -369,6 +370,10 @@ void RimLegendConfig::updateLegend()
}
m_scalarMapperLegend->setTickPrecision(cvf::Math::clamp(numDecimalDigits, 0, 20));
RiaApplication* app = RiaApplication::instance();
RiaPreferences* preferences = app->preferences();
m_scalarMapperLegend->enableBackground(preferences->showLegendBackground());
m_categoryLegend->enableBackground(preferences->showLegendBackground());
if (m_globalAutoMax != cvf::UNDEFINED_DOUBLE )
{

View File

@ -35,6 +35,7 @@
#include "cvfqtUtils.h"
#include <cmath>
#include "RiaPreferences.h"
CAF_PDM_SOURCE_INIT(RimTernaryLegendConfig, "RimTernaryLegendConfig");
@ -201,6 +202,10 @@ void RimTernaryLegendConfig::updateLegend()
if (!m_legend.isNull())
{
m_legend->setRangeText(soilRange, sgasRange, swatRange);
RiaApplication* app = RiaApplication::instance();
RiaPreferences* preferences = app->preferences();
m_legend->enableBackground(preferences->showLegendBackground());
}
}