changeset 1126:5c3333fb70b3 spectrogram-minor-refactor

Must set range mappers before default values -- the presence of a range mapper alters the way the default is set up
author Chris Cannam
date Mon, 01 Aug 2016 16:13:29 +0100
parents 50324fca1328
children 9fb8dfd7ce4c
files widgets/PropertyBox.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/PropertyBox.cpp	Mon Aug 01 15:06:16 2016 +0100
+++ b/widgets/PropertyBox.cpp	Mon Aug 01 16:13:29 2016 +0100
@@ -212,10 +212,10 @@
 	gainDial->setFixedWidth(24);
 	gainDial->setFixedHeight(24);
 	gainDial->setNotchesVisible(false);
-	gainDial->setDefaultValue(0);
         gainDial->setObjectName(tr("Playback Gain"));
         gainDial->setRangeMapper(new LinearRangeMapper
                                  (-50, 50, -25, 25, tr("dB")));
+	gainDial->setDefaultValue(0);
         gainDial->setShowToolTip(true);
 	connect(gainDial, SIGNAL(valueChanged(int)),
 		this, SLOT(playGainDialChanged(int)));
@@ -384,8 +384,10 @@
 	    dial->setMaximum(max);
 	    dial->setPageStep(1);
 	    dial->setNotchesVisible((max - min) <= 12);
+            // important to set the range mapper before the default,
+            // because the range mapper is used to map the default
+            dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
 	    dial->setDefaultValue(deflt);
-            dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
             dial->setShowToolTip(true);
 	    connect(dial, SIGNAL(valueChanged(int)),
 		    this, SLOT(propertyControllerChanged(int)));