![]() |
![]() |
#include <Iguana/GLBrowsers/interface/IgQtRangeControlFloat.h>
Public Types | |
typedef IgQtRangeValueFloat | inherited |
Signals | |
void | newValue (float newval) |
void | valueChanged (float delta) |
Public Member Functions | |
void | editSettings (void) |
void | fwdLong (void) |
void | fwdMax (void) |
void | fwdSmall (void) |
float | getLongStep (void) const |
Get the size of the long step. | |
QString | getSettingString (void) const |
float | getSmallStep (void) const |
Get the size of the small step. | |
IgQtRangeControlFloat (QWidget *parent, int parts, float value=0, const char *name=0) | |
void | revLong (void) |
void | revMin (void) |
void | revSmall (void) |
void | setDirty (bool dirty) |
void | setLongStep (float size) |
Set the length of the long step to value. | |
virtual void | setPrecision (float precision) |
void | setRange (float min, float max) |
Set the range of the control to be from min to max, inclusive. | |
void | setSettingString (QString &setting) |
void | setSmallStep (float size) |
Set the small step size to value. | |
void | setValue (float newval) |
float | stringToNumber (const QString &val) const |
Protected Member Functions | |
virtual void | adjustSliderSteps (void) |
Adjust the slider to go from minimum to the maximum with as many discrete values as we have small steps, and the page size to the ratio of long step from the small one. | |
void | emitSignals (void) |
void | fwdEnable (bool enable) |
void | initialize (int parts) |
void | moveValue (float delta, MoveDirection dir) |
void | revEnable (bool enable) |
void | sliderChanged (int newval) |
Slider has changed to position value small steps from the minimum. | |
void | textChanged (const QString &newval) |
Protected Attributes | |
float | m_longStep |
float | m_smallStep |
Definition at line 16 of file IgQtRangeControlFloat.h.
IgQtRangeControlFloat::IgQtRangeControlFloat | ( | QWidget * | parent, | |
int | parts, | |||
float | value = 0 , |
|||
const char * | name = 0 | |||
) |
Definition at line 18 of file IgQtRangeControlFloat.cc.
References initialize().
00021 : IgQtRangeControl (parent, parts, name), 00022 inherited (value), 00023 m_longStep (0.1), 00024 m_smallStep (0.01) 00025 { initialize (parts); }
Adjust the slider to go from minimum to the maximum with as many discrete values as we have small steps, and the page size to the ratio of long step from the small one.
Definition at line 93 of file IgQtRangeControlFloat.cc.
References HLT_VtxMuL3::connect, m_longStep, IgQtRangeControlCommon::m_slider, m_smallStep, IgQtRangeValue< float >::maxValue(), IgQtRangeValue< float >::minValue(), sliderChanged(), IgQtRangeValue< float >::value(), and valueChanged().
Referenced by setLongStep(), setRange(), and setSmallStep().
00094 { 00095 if (m_slider) 00096 { 00097 disconnect (m_slider, SIGNAL (valueChanged (int)), 00098 this, SLOT (sliderChanged (int))); 00099 m_slider->setRange (0, int (round ((maxValue()-minValue()) / m_smallStep))); 00100 m_slider->setPageStep (int (round (m_longStep / m_smallStep))); 00101 m_slider->setValue (int (round ((value () - minValue ()) / m_smallStep))); 00102 connect (m_slider, SIGNAL (valueChanged (int)), 00103 this, SLOT (sliderChanged (int))); 00104 } 00105 }
Reimplemented from IgQtRangeControlCommon.
Definition at line 263 of file IgQtRangeControlFloat.cc.
References IgQtRangeSetting::clear(), IgQtRangeControlCommon::editSettingsChanged(), IgQtRangeSetting::enablePrecision(), IgQtRangeSetting::enableRange(), IgQtRangeSetting::enableStep(), IgQtRangeSetting::enableValue(), IgQtRangeSetting::getLong(), getLongStep(), IgQtRangeSetting::getMax(), IgQtRangeSetting::getMin(), IgQtRangeSetting::getPrecision(), IgQtRangeSetting::getSmall(), getSmallStep(), IgQtRangeSetting::getValue(), IgQtRangeSetting::isApplied(), IgQtRangeSetting::isPrecisionChanged(), IgQtRangeControlCommon::isPrecisionEditable(), IgQtRangeSetting::isRangeChanged(), IgQtRangeControlCommon::isRangeEditable(), IgQtRangeSetting::isStepChanged(), IgQtRangeControlCommon::isStepEditable(), IgQtRangeSetting::isValueChanged(), IgQtRangeControlCommon::isValueEditable(), IgQtRangeValue< float >::maxValue(), IgQtRangeValue< float >::minValue(), IgQtRangeValuePrecision::precision(), IgQtRangeControlCommon::setEmitSettingsChanged(), IgQtRangeSetting::setLong(), setLongStep(), IgQtRangeSetting::setMax(), IgQtRangeSetting::setMin(), IgQtRangeSetting::setPrecision(), setPrecision(), setRange(), IgQtRangeSetting::setSmall(), setSmallStep(), IgQtRangeSetting::setValue(), stringToNumber(), textChanged(), IgQtRangeValue< float >::value(), and IgQtRangeControlCommon::widget().
00264 { 00265 IgQtRangeSetting* setting = new IgQtRangeSetting (widget (), "setting"); 00266 setting->setValue (QString::number (value ())); 00267 setting->setPrecision (QString::number (precision ())); 00268 setting->setMin (QString::number (minValue ())); 00269 setting->setMax (QString::number (maxValue ())); 00270 setting->setSmall (QString::number (getSmallStep ())); 00271 setting->setLong (QString::number (getLongStep ())); 00272 setting->enableValue (isValueEditable ()); 00273 setting->enableStep (isStepEditable ()); 00274 setting->enableRange (isRangeEditable ()); 00275 setting->enablePrecision (isPrecisionEditable ()); 00276 setting->clear (); 00277 setting->exec (); 00278 bool changed = false; 00279 setEmitSettingsChanged (false); 00280 if (setting->isApplied ()) 00281 { 00282 if (setting->isPrecisionChanged ()) 00283 { 00284 setPrecision (stringToNumber (setting->getPrecision ())); 00285 changed = true; 00286 } 00287 if (setting->isRangeChanged ()) 00288 { 00289 setRange (stringToNumber (setting->getMin ()), 00290 stringToNumber (setting->getMax ())); 00291 changed = true; 00292 } 00293 if (setting->isStepChanged ()) 00294 { 00295 setSmallStep (stringToNumber (setting->getSmall ())); 00296 setLongStep (stringToNumber (setting->getLong ())); 00297 changed = true; 00298 } 00299 if (setting->isValueChanged ()) 00300 textChanged (setting->getValue ()); 00301 } 00302 setEmitSettingsChanged (true); 00303 if (changed) 00304 editSettingsChanged (); 00305 delete setting; 00306 }
Reimplemented from IgQtRangeControlCommon.
Definition at line 141 of file IgQtRangeControlFloat.cc.
References newValue(), IgQtRangeValue< float >::value(), IgQtRangeValue< float >::valueChange(), and valueChanged().
Referenced by setDirty().
00142 { 00143 emit newValue (value ()); 00144 emit valueChanged (valueChange ()); 00145 }
Reimplemented from IgQtRangeControlCommon.
Definition at line 249 of file IgQtRangeControlFloat.cc.
References IgQtRangeValue< float >::boundaryHandling(), IgQtRangeControlCommon::fwdEnable(), and IgQtRangeValue< float >::MODULATE.
Referenced by setValue().
00250 { 00251 if (!(!value && boundaryHandling () == MODULATE)) 00252 IgQtRangeControl::fwdEnable (value); 00253 }
Reimplemented from IgQtRangeControlCommon.
Definition at line 133 of file IgQtRangeControlFloat.cc.
References m_longStep, IgQtRangeControlCommon::MoveFWD, and moveValue().
00134 { moveValue (m_longStep, MoveFWD); }
Reimplemented from IgQtRangeControlCommon.
Definition at line 137 of file IgQtRangeControlFloat.cc.
References IgQtRangeValue< float >::maxValue(), and setValue().
Reimplemented from IgQtRangeControlCommon.
Definition at line 129 of file IgQtRangeControlFloat.cc.
References m_smallStep, IgQtRangeControlCommon::MoveFWD, and moveValue().
00130 { moveValue (m_smallStep, MoveFWD); }
float IgQtRangeControlFloat::getLongStep | ( | void | ) | const |
Get the size of the long step.
Definition at line 69 of file IgQtRangeControlFloat.cc.
References m_longStep.
Referenced by editSettings(), and getSettingString().
00070 { return m_longStep; }
QString IgQtRangeControlFloat::getSettingString | ( | void | ) | const |
Definition at line 309 of file IgQtRangeControlFloat.cc.
References IgQtRangeControlCommon::addSettingItem(), getLongStep(), getSmallStep(), IgQtRangeValue< float >::maxValue(), IgQtRangeValue< float >::minValue(), and IgQtRangeValuePrecision::precision().
Referenced by Ig3DPlaneControl::getSettingString(), and Ig3DRotationFControl::getSettingString().
00310 { 00311 QString setting (""); 00312 addSettingItem (QString::number(minValue ()), setting); 00313 addSettingItem (QString::number(maxValue ()), setting); 00314 addSettingItem (QString::number(getSmallStep ()), setting); 00315 addSettingItem (QString::number(getLongStep ()), setting); 00316 addSettingItem (QString::number(precision ()), setting); 00317 return setting; 00318 }
float IgQtRangeControlFloat::getSmallStep | ( | void | ) | const |
Get the size of the small step.
Definition at line 51 of file IgQtRangeControlFloat.cc.
References m_smallStep.
Referenced by editSettings(), and getSettingString().
00052 { return m_smallStep; }
Reimplemented from IgQtRangeControlCommon.
Definition at line 28 of file IgQtRangeControlFloat.cc.
References IgQtRangeValue< float >::forceValue(), IgQtRangeValue< float >::forceValueChanged(), m_smallStep, setPrecision(), setRange(), setValue(), and IgQtRangeValue< float >::value().
Referenced by IgQtRangeControlFloat().
00029 { 00030 // Pretend to step into the value to get it properly bounded 00031 setPrecision (.01); 00032 float oldValue = value (); 00033 setRange (SHRT_MIN, SHRT_MAX); 00034 forceValue (value () + m_smallStep); 00035 setValue (oldValue); 00036 forceValueChanged (0); 00037 }
void IgQtRangeControlFloat::moveValue | ( | float | delta, | |
MoveDirection | dir | |||
) | [protected] |
Definition at line 151 of file IgQtRangeControlFloat.cc.
References IgQtRangeControlCommon::ADD, IgQtRangeControlCommon::m_stepType, IgQtRangeControlCommon::MoveREV, IgQtRangeControlCommon::MULTIPLE, IgQtRangeValuePrecision::precision(), IgQtRangeValuePrecision::setPrecision(), setValue(), and IgQtRangeValue< float >::value().
Referenced by fwdLong(), fwdSmall(), revLong(), and revSmall().
00152 { 00153 float oldPrecision = precision (); 00154 IgQtRangeValuePrecision::setPrecision (delta); 00155 00156 switch (m_stepType) 00157 { 00158 case ADD: 00159 setValue (value () + (direction == MoveREV ? -delta : delta)); 00160 break; 00161 00162 case MULTIPLE: 00163 setValue (value () * (direction == MoveREV ? 1/delta : delta)); 00164 break; 00165 } 00166 00167 IgQtRangeValuePrecision::setPrecision (oldPrecision); 00168 setValue (value ()); 00169 }
void IgQtRangeControlFloat::newValue | ( | float | newval | ) | [signal] |
Referenced by emitSignals().
Reimplemented from IgQtRangeControlCommon.
Definition at line 256 of file IgQtRangeControlFloat.cc.
References IgQtRangeValue< float >::boundaryHandling(), IgQtRangeValue< float >::MODULATE, and IgQtRangeControlCommon::revEnable().
Referenced by setValue().
00257 { 00258 if (!(!value && boundaryHandling () == MODULATE)) 00259 IgQtRangeControl::revEnable (value); 00260 }
Reimplemented from IgQtRangeControlCommon.
Definition at line 121 of file IgQtRangeControlFloat.cc.
References m_longStep, IgQtRangeControlCommon::MoveREV, and moveValue().
00122 { moveValue (m_longStep, MoveREV); }
Reimplemented from IgQtRangeControlCommon.
Definition at line 117 of file IgQtRangeControlFloat.cc.
References IgQtRangeValue< float >::minValue(), and setValue().
Reimplemented from IgQtRangeControlCommon.
Definition at line 125 of file IgQtRangeControlFloat.cc.
References m_smallStep, IgQtRangeControlCommon::MoveREV, and moveValue().
00126 { moveValue (m_smallStep, MoveREV); }
Reimplemented from IgQtRangeControlCommon.
Definition at line 232 of file IgQtRangeControlFloat.cc.
References emitSignals(), IgQtRangeValue< float >::forceValueChanged(), IgQtRangeControlCommon::m_resetChangedValue, and IgControlItem::setDirty().
00233 { 00234 if (dirty) 00235 { 00236 emitSignals (); 00237 IgQtRangeControl::setDirty (dirty); 00238 if (m_resetChangedValue) 00239 forceValueChanged (0); 00240 } 00241 else 00242 { 00243 forceValueChanged (0); 00244 IgQtRangeControl::setDirty (dirty); 00245 } 00246 }
void IgQtRangeControlFloat::setLongStep | ( | float | value | ) |
Set the length of the long step to value.
Definition at line 74 of file IgQtRangeControlFloat.cc.
References adjustSliderSteps(), IgQtRangeControlCommon::editSettingsChanged(), m_longStep, m_smallStep, IgQtRangeValuePrecision::precision(), and IgQtRangeValuePrecision::setPrecision().
Referenced by IgExaminerViewerCategory::addExaminerViewerTab(), editSettings(), Ig3DLightsCategory::Ig3DLightsCategory(), Ig3DRotationFControl::Ig3DRotationFControl(), Ig3DUnitVec3fControl::Ig3DUnitVec3fControl(), Ig3DViewpointsCategory::Ig3DViewpointsCategory(), Ig3DVectorBaseControl::makeControl(), and setSettingString().
00075 { 00076 m_longStep = fabs (value); 00077 if (m_smallStep > m_longStep) 00078 { 00079 IgQtRangeValuePrecision::setPrecision (m_longStep); 00080 m_smallStep = precision (); 00081 } 00082 adjustSliderSteps (); 00083 editSettingsChanged (); 00084 }
void IgQtRangeControlFloat::setPrecision | ( | float | precision | ) | [virtual] |
Reimplemented from IgQtRangeValuePrecision.
Definition at line 43 of file IgQtRangeControlFloat.cc.
References IgQtRangeControlCommon::editSettingsChanged(), and IgQtRangeValuePrecision::setPrecision().
Referenced by editSettings(), initialize(), setSettingString(), and Ig3DUnitVec3fControl::setValues().
00044 { 00045 IgQtRangeValuePrecision::setPrecision (value); 00046 editSettingsChanged (); 00047 }
void IgQtRangeControlFloat::setRange | ( | float | min, | |
float | max | |||
) | [virtual] |
Set the range of the control to be from min to max, inclusive.
If the current value is outside that range, it is adjusted to fall into it.
Reimplemented from IgQtRangeValue< float >.
Definition at line 223 of file IgQtRangeControlFloat.cc.
References adjustSliderSteps(), IgQtRangeControlCommon::editSettingsChanged(), and IgQtRangeValue< float >::setRange().
Referenced by editSettings(), Ig3DFieldPlanesCategory::Ig3DFieldPlanesCategory(), Ig3DGridCategory::Ig3DGridCategory(), Ig3DLightsCategory::Ig3DLightsCategory(), Ig3DPlaneControl::Ig3DPlaneControl(), Ig3DRotationFControl::Ig3DRotationFControl(), Ig3DSlicersCategory::Ig3DSlicersCategory(), Ig3DUnitVec3fControl::Ig3DUnitVec3fControl(), initialize(), Ig3DVectorBaseControl::makeControl(), and setSettingString().
00224 { 00225 // Like base class, just adjust the number of slider steps. 00226 inherited::setRange (min, max); 00227 adjustSliderSteps (); 00228 editSettingsChanged (); 00229 }
void IgQtRangeControlFloat::setSettingString | ( | QString & | setting | ) |
Definition at line 321 of file IgQtRangeControlFloat.cc.
References IgQtRangeControlCommon::editSettingsChanged(), IgQtRangeControlCommon::getSettingItem(), IgQtRangeControlCommon::isEmitSettingsChanged(), IgQtRangeValue< float >::maxValue(), min, IgQtRangeControlCommon::setEmitSettingsChanged(), setLongStep(), setPrecision(), setRange(), setSmallStep(), and stringToNumber().
Referenced by Ig3DPlaneControl::setSettingString(), and Ig3DRotationFControl::setSettingString().
00322 { 00323 bool oldValue = isEmitSettingsChanged (); 00324 setEmitSettingsChanged (false); 00325 00326 if (!setting.isEmpty ()) 00327 { 00328 float min = stringToNumber (getSettingItem (setting)); 00329 if (!setting.isEmpty ()) 00330 setRange (min , stringToNumber (getSettingItem (setting))); 00331 else 00332 setRange (min , maxValue ()); 00333 } 00334 00335 if (!setting.isEmpty ()) 00336 setSmallStep (stringToNumber (getSettingItem (setting))); 00337 00338 if (!setting.isEmpty ()) 00339 setLongStep (stringToNumber (getSettingItem (setting))); 00340 00341 if (!setting.isEmpty ()) 00342 setPrecision (stringToNumber (getSettingItem (setting))); 00343 00344 setEmitSettingsChanged (oldValue); 00345 editSettingsChanged (); 00346 }
void IgQtRangeControlFloat::setSmallStep | ( | float | value | ) |
Set the small step size to value.
Definition at line 56 of file IgQtRangeControlFloat.cc.
References adjustSliderSteps(), IgQtRangeControlCommon::editSettingsChanged(), m_longStep, m_smallStep, IgQtRangeValuePrecision::precision(), and IgQtRangeValuePrecision::setPrecision().
Referenced by IgExaminerViewerCategory::addExaminerViewerTab(), editSettings(), Ig3DLightsCategory::Ig3DLightsCategory(), Ig3DRotationFControl::Ig3DRotationFControl(), Ig3DUnitVec3fControl::Ig3DUnitVec3fControl(), Ig3DViewpointsCategory::Ig3DViewpointsCategory(), Ig3DVectorBaseControl::makeControl(), and setSettingString().
00057 { 00058 IgQtRangeValuePrecision::setPrecision (value); 00059 m_smallStep = precision (); 00060 if (m_longStep < m_smallStep) 00061 m_longStep = m_smallStep; 00062 00063 adjustSliderSteps (); 00064 editSettingsChanged (); 00065 }
void IgQtRangeControlFloat::setValue | ( | float | newval | ) | [virtual] |
Reimplemented from IgQtRangeValueFloat.
Definition at line 176 of file IgQtRangeControlFloat.cc.
References HLT_VtxMuL3::connect, IgQtRangeValue< float >::forceValueChanged(), fwdEnable(), int, IgQtRangeControlCommon::m_slider, m_smallStep, IgQtRangeControlCommon::m_text, IgQtRangeValue< float >::maxValue(), IgQtRangeValue< float >::minValue(), IgQtRangeValuePrecision::precision(), revEnable(), IgQtLineEdit::setChanged(), IgControlItem::setDirty(), reco::JetTracksAssociation::setValue(), sliderChanged(), IgQtRangeValue< float >::value(), IgQtRangeValue< float >::valueChange(), and valueChanged().
Referenced by IgExaminerViewerCategory::browserChanged(), fwdMax(), initialize(), Ig3DVectorBaseControl::makeControl(), moveValue(), revMin(), sliderChanged(), and textChanged().
00177 { 00178 // First let the base class handle it. If the value doesn't 00179 // actually change, we have nothing further to do. 00180 //If tracking was not on then keep the accumulate the change value 00181 float prevChangedValue = valueChange (); 00182 inherited::setValue (newval); 00183 if (! valueChange ()) 00184 { 00185 forceValueChanged (prevChangedValue); 00186 return; 00187 } 00188 forceValueChanged (prevChangedValue + valueChange ()); 00189 00190 // Adjust the various display. 00191 if (m_text) 00192 { 00193 int prec = precision () ? int (fabs (log10 (precision ())) + .5) : 6; 00194 m_text->setText (QString::number (value (), 'f', prec)); 00195 m_text->setChanged (false); 00196 } 00197 00198 if (m_slider) 00199 { 00200 disconnect (m_slider, SIGNAL (valueChanged (int)), 00201 this, SLOT (sliderChanged (int))); 00202 00203 m_slider->setValue (int (round ((value () - minValue ()) / m_smallStep))); 00204 00205 connect (m_slider, SIGNAL (valueChanged (int)), 00206 this, SLOT (sliderChanged (int))); 00207 } 00208 00209 // Indicate where we are for various buttons and then set myself 00210 // dirty so they'll get updated. 00211 fwdEnable (maxValue () - value () >= m_smallStep); 00212 revEnable (value () - minValue () >= m_smallStep); 00213 setDirty (); 00214 }
Slider has changed to position value small steps from the minimum.
Adjust current control value.
Reimplemented from IgQtRangeControlCommon.
Definition at line 110 of file IgQtRangeControlFloat.cc.
References m_smallStep, IgQtRangeValue< float >::minValue(), and setValue().
Referenced by adjustSliderSteps(), and setValue().
00111 { setValue ((value * m_smallStep) + minValue ()); }
float IgQtRangeControlFloat::stringToNumber | ( | const QString & | val | ) | const [inline] |
Definition at line 30 of file IgQtRangeControlFloat.h.
Referenced by editSettings(), setSettingString(), and textChanged().
void IgQtRangeControlFloat::textChanged | ( | const QString & | newval | ) | [protected, virtual] |
Reimplemented from IgQtRangeControlCommon.
Definition at line 172 of file IgQtRangeControlFloat.cc.
References setValue(), and stringToNumber().
Referenced by editSettings().
00173 { setValue (stringToNumber (newval)); }
void IgQtRangeControlFloat::valueChanged | ( | float | delta | ) | [signal] |
Referenced by adjustSliderSteps(), emitSignals(), and setValue().
float IgQtRangeControlFloat::m_longStep [protected] |
Definition at line 72 of file IgQtRangeControlFloat.h.
Referenced by adjustSliderSteps(), fwdLong(), getLongStep(), revLong(), setLongStep(), and setSmallStep().
float IgQtRangeControlFloat::m_smallStep [protected] |
Definition at line 73 of file IgQtRangeControlFloat.h.
Referenced by adjustSliderSteps(), fwdSmall(), getSmallStep(), initialize(), revSmall(), setLongStep(), setSmallStep(), setValue(), and sliderChanged().