CMS 3D CMS Logo

IgQtRangeControlImp< T > Class Template Reference

#include <Iguana/GLBrowsers/interface/IgQtRangeControlImp.h>

Inheritance diagram for IgQtRangeControlImp< T >:

IgQtRangeControl IgQtRangeValue< T > IgQtRangeControlCommon IgControlItem

List of all members.

Public Types

typedef IgQtRangeControlImp< T > inherited

Public Member Functions

void editSettings (void)
void fwdLong (void)
void fwdMax (void)
void fwdSmall (void)
getLongStep (void) const
QString getSettingString (void) const
getSmallStep (void) const
 IgQtRangeControlImp (QWidget *parent, int parts, T value=0, const char *name=0)
void revLong (void)
void revMin (void)
void revSmall (void)
void setDirty (bool dirty)
void setLongStep (T size)
void setRange (T min, T max)
void setSettingString (QString &setting)
void setSmallStep (T size)
virtual void setValue (T newval)
void sliderChanged (int value)
 Slider has changed to position value small steps from the minimum.
virtual T stringToNumber (const QString &) const

Protected Member Functions

virtual void adjustSliderSteps (void)
void fwdEnable (bool enable)
void initialize (int parts)
virtual void moveValue (T delta, MoveDirection direction)
void revEnable (bool enable)
virtual void textChanged (const QString &newval)

Protected Attributes

m_longStep
m_smallStep


Detailed Description

template<class T>
class IgQtRangeControlImp< T >

Definition at line 20 of file IgQtRangeControlImp.h.


Member Typedef Documentation

template<class T>
typedef IgQtRangeControlImp<T> IgQtRangeControlImp< T >::inherited

Reimplemented from IgQtRangeValue< T >.

Definition at line 23 of file IgQtRangeControlImp.h.


Constructor & Destructor Documentation

template<class T>
IgQtRangeControlImp< T >::IgQtRangeControlImp ( QWidget *  parent,
int  parts,
value = 0,
const char *  name = 0 
) [inline]

Definition at line 205 of file IgQtRangeControlImp.h.

References IgQtRangeControlImp< T >::initialize().

00208     : IgQtRangeControl  (parent, parts, name),
00209       IgQtRangeValue<T> (value),
00210       m_longStep   (5),
00211       m_smallStep  (1)
00212 { initialize (parts);}


Member Function Documentation

template<class T>
virtual void IgQtRangeControlImp< T >::adjustSliderSteps ( void   )  [inline, protected, virtual]

Definition at line 170 of file IgQtRangeControlImp.h.

00171     {
00172       if (m_slider)
00173       {
00174         disconnect (m_slider, SIGNAL (valueChanged (int)),
00175                     this,     SLOT (sliderChanged (int)));
00176         m_slider->setRange (0, int (round ((inherited::maxValue()-inherited::minValue()) / m_smallStep)));
00177         m_slider->setPageStep (int (round (m_longStep / m_smallStep)));
00178         m_slider->setValue (int (round ((inherited::value () - inherited::minValue ()) / m_smallStep)));
00179         connect (m_slider, SIGNAL (valueChanged (int)),
00180                  this,     SLOT (sliderChanged (int)));
00181       }
00182     }

template<class T>
void IgQtRangeControlImp< T >::editSettings ( void   )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 92 of file IgQtRangeControlImp.h.

00093     {
00094       IgQtRangeSetting* setting = new IgQtRangeSetting (widget (), "setting");
00095       setting->setPrecision ("");
00096       setting->setValue (QString::number (inherited::value ()));
00097       setting->setMin (QString::number (inherited::minValue ()));
00098       setting->setMax (QString::number (inherited::maxValue ()));
00099       setting->setSmall (QString::number (getSmallStep ()));
00100       setting->setLong (QString::number (getLongStep ()));
00101       setting->enableValue (isValueEditable ());
00102       setting->enableStep (isStepEditable ());
00103       setting->enableRange (isRangeEditable ());
00104       setting->enablePrecision (isPrecisionEditable ());
00105       setting->clear ();
00106       setting->exec ();
00107       bool changed = false;
00108       setEmitSettingsChanged (false);
00109       if (setting->isApplied ())
00110       {
00111         if (setting->isRangeChanged ())
00112         {
00113           setRange (stringToNumber (setting->getMin ()),
00114                     stringToNumber (setting->getMax ()));
00115           changed = true;
00116         }
00117         if (setting->isStepChanged ())
00118         {
00119           setSmallStep (stringToNumber (setting->getSmall ()));
00120           setLongStep  (stringToNumber (setting->getLong ()));
00121           changed = true;
00122         }
00123         if (setting->isValueChanged ())
00124           textChanged (setting->getValue ());
00125       }
00126       setEmitSettingsChanged (true);
00127       if (changed)
00128         editSettingsChanged ();
00129      delete setting;
00130     }

template<class T>
void IgQtRangeControlImp< T >::fwdEnable ( bool  enable  )  [inline, protected, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 186 of file IgQtRangeControlImp.h.

Referenced by IgQtRangeControlImp< T >::setValue().

00187     {
00188       if (!(!enable && inherited::boundaryHandling () == inherited::MODULATE))
00189         IgQtRangeControl::fwdEnable (enable);
00190     }

template<class T>
void IgQtRangeControlImp< T >::fwdLong ( void   )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 81 of file IgQtRangeControlImp.h.

template<class T>
void IgQtRangeControlImp< T >::fwdMax ( void   )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 84 of file IgQtRangeControlImp.h.

00085     { setValue (inherited::maxValue ()); }

template<class T>
void IgQtRangeControlImp< T >::fwdSmall ( void   )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 78 of file IgQtRangeControlImp.h.

template<class T>
T IgQtRangeControlImp< T >::getLongStep ( void   )  const [inline]

Definition at line 38 of file IgQtRangeControlImp.h.

00039     { return m_longStep; }

template<class T>
QString IgQtRangeControlImp< T >::getSettingString ( void   )  const [inline]

Definition at line 132 of file IgQtRangeControlImp.h.

00133     {
00134       QString setting ("");
00135       addSettingItem (QString::number(inherited::minValue ()), setting);
00136       addSettingItem (QString::number(inherited::maxValue ()), setting);
00137       addSettingItem (QString::number(getSmallStep ()), setting);
00138       addSettingItem (QString::number(getLongStep ()), setting);
00139       return setting;
00140     }

template<class T>
T IgQtRangeControlImp< T >::getSmallStep ( void   )  const [inline]

Definition at line 35 of file IgQtRangeControlImp.h.

00036     { return m_smallStep; }

template<class T>
void IgQtRangeControlImp< T >::initialize ( int  parts  )  [inline, protected, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 215 of file IgQtRangeControlImp.h.

References IgQtRangeValue< T >::forceValue(), IgQtRangeValue< T >::forceValueChanged(), IgQtRangeControlImp< T >::m_smallStep, IgQtRangeControlCommon::precisionEditable(), IgQtRangeControlImp< T >::setValue(), value, and IgQtRangeValue< T >::value().

Referenced by IgQtRangeControlImp< T >::IgQtRangeControlImp().

00216 {
00217     // Pretend to step into the value to get it properly bounded
00218     T oldValue = inherited::value ();
00219     inherited::forceValue (inherited::value () + m_smallStep);
00220     setValue (oldValue);
00221     inherited::forceValueChanged (0);
00222     precisionEditable (false);
00223 }

template<class T>
void IgQtRangeControlImp< T >::moveValue ( delta,
MoveDirection  direction 
) [inline, protected, virtual]

Definition at line 283 of file IgQtRangeControlImp.h.

References IgQtRangeControlCommon::ADD, IgQtRangeControlCommon::m_stepType, IgQtRangeValue< T >::maxValue(), IgQtRangeValue< T >::minValue(), IgQtRangeControlCommon::MoveREV, IgQtRangeControlCommon::MULTIPLE, IgQtRangeControlImp< T >::setValue(), value, and IgQtRangeValue< T >::value().

00284 {
00285     T oldValue = inherited::value ();
00286     switch (m_stepType)
00287     {
00288     case ADD:
00289       if(direction == MoveREV)
00290       {
00291         T newValue = oldValue - delta;
00292         if (newValue < oldValue)
00293           setValue (newValue < inherited::minValue () ? inherited::minValue (): newValue);
00294         else
00295           setValue (inherited::minValue ());
00296       }
00297       else
00298       {
00299         T newValue = oldValue + delta;
00300         if (newValue > oldValue)
00301           setValue (newValue > inherited::maxValue () ? inherited::maxValue (): newValue);
00302         else
00303           setValue (inherited::maxValue ());
00304       }
00305       break;
00306     case MULTIPLE:
00307       setValue (inherited::value () * (direction == MoveREV ? 1/delta : delta));
00308       break;
00309     }
00310 }

template<class T>
void IgQtRangeControlImp< T >::revEnable ( bool  enable  )  [inline, protected, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 192 of file IgQtRangeControlImp.h.

Referenced by IgQtRangeControlImp< T >::setValue().

00193     {
00194       if (!(!enable && inherited::boundaryHandling () == inherited::MODULATE))
00195         IgQtRangeControl::revEnable (enable);
00196     }

template<class T>
void IgQtRangeControlImp< T >::revLong ( void   )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 72 of file IgQtRangeControlImp.h.

template<class T>
void IgQtRangeControlImp< T >::revMin ( void   )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 69 of file IgQtRangeControlImp.h.

00070     { setValue (inherited::minValue ()); }

template<class T>
void IgQtRangeControlImp< T >::revSmall ( void   )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 75 of file IgQtRangeControlImp.h.

template<class T>
void IgQtRangeControlImp< T >::setDirty ( bool  dirty  )  [inline, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 266 of file IgQtRangeControlImp.h.

References IgQtRangeControlCommon::emitSignals(), IgQtRangeValue< T >::forceValueChanged(), IgQtRangeControlCommon::m_resetChangedValue, and IgControlItem::setDirty().

00267 {
00268     if (dirty)
00269     {
00270         emitSignals ();
00271         IgQtRangeControl::setDirty (dirty);
00272         if (m_resetChangedValue)
00273           inherited::forceValueChanged (0);
00274     }
00275     else
00276     {
00277         inherited::forceValueChanged (0);
00278         IgQtRangeControl::setDirty (dirty);
00279     }
00280 }

template<class T>
void IgQtRangeControlImp< T >::setLongStep ( size  )  [inline]

Definition at line 50 of file IgQtRangeControlImp.h.

Referenced by IgExaminerViewerCategory::addExaminerViewerTab(), and IgGLRenderCategory::addGLRenderTab().

00051     {
00052       m_longStep = size;
00053       if (m_smallStep > m_longStep)
00054         m_smallStep = m_longStep;
00055       adjustSliderSteps ();
00056       editSettingsChanged ();
00057     }

template<class T>
void IgQtRangeControlImp< T >::setRange ( min,
max 
) [inline, virtual]

Reimplemented from IgQtRangeValue< T >.

Definition at line 59 of file IgQtRangeControlImp.h.

Referenced by Ig3DAnimsCategory::Ig3DAnimsCategory(), and Ig3DFieldPlanesCategory::Ig3DFieldPlanesCategory().

00060     {
00061       // Like base class, just adjust the number of slider steps.
00062       IgQtRangeValue<T>::setRange (min, max);
00063       adjustSliderSteps ();
00064       editSettingsChanged ();
00065     }

template<class T>
void IgQtRangeControlImp< T >::setSettingString ( QString &  setting  )  [inline]

Definition at line 142 of file IgQtRangeControlImp.h.

00143     {
00144       bool oldValue = isEmitSettingsChanged ();
00145       setEmitSettingsChanged (false);
00146     
00147       if (!setting.isEmpty ())
00148       {
00149         T min = stringToNumber (getSettingItem (setting));
00150         if (!setting.isEmpty ())
00151           setRange (min , stringToNumber (getSettingItem (setting)));
00152         else
00153           setRange (min , inherited::maxValue ());
00154       }
00155       
00156       if (!setting.isEmpty ())
00157         setSmallStep (stringToNumber (getSettingItem (setting)));
00158         
00159       if (!setting.isEmpty ())
00160         setLongStep (stringToNumber (getSettingItem (setting)));
00161     
00162       setEmitSettingsChanged (oldValue);
00163       editSettingsChanged ();
00164     }

template<class T>
void IgQtRangeControlImp< T >::setSmallStep ( size  )  [inline]

Definition at line 41 of file IgQtRangeControlImp.h.

Referenced by IgExaminerViewerCategory::addExaminerViewerTab(), and IgGLRenderCategory::addGLRenderTab().

00042     {
00043       m_smallStep = size;
00044       if (m_longStep < m_smallStep)
00045           m_longStep = m_smallStep;
00046       adjustSliderSteps ();
00047       editSettingsChanged ();
00048     }

template<class T>
void IgQtRangeControlImp< T >::setValue ( newval  )  [inline, virtual]

Reimplemented from IgQtRangeValue< T >.

Definition at line 226 of file IgQtRangeControlImp.h.

References HLT_VtxMuL3::connect, IgQtRangeValue< T >::forceValueChanged(), IgQtRangeControlImp< T >::fwdEnable(), IgQtRangeControlCommon::m_slider, IgQtRangeControlImp< T >::m_smallStep, IgQtRangeControlCommon::m_text, IgQtRangeValue< T >::maxValue(), IgQtRangeValue< T >::minValue(), IgQtRangeControlImp< T >::revEnable(), IgQtLineEdit::setChanged(), IgControlItem::setDirty(), IgQtRangeValue< T >::setValue(), IgQtRangeControlImp< T >::sliderChanged(), IgQtRangeValue< T >::value(), and IgQtRangeValue< T >::valueChange().

Referenced by IgExaminerViewerCategory::browserChanged(), IgGLRenderCategory::browserChanged(), IgQtRangeControlImp< T >::initialize(), and IgQtRangeControlImp< T >::moveValue().

00227 {
00228     // First let the base class handle it.  If the value doesn't
00229     // actually change, we have nothing further to do.
00230     //If tracking was not on then keep the accumulate the change value
00231     T prevChangedValue = inherited::valueChange ();
00232     IgQtRangeValue<T>::setValue (newval);
00233     if (! inherited::valueChange ())
00234     {
00235         inherited::forceValueChanged (prevChangedValue);
00236         return;
00237     }
00238     inherited::forceValueChanged (prevChangedValue + inherited::valueChange ());
00239 
00240     // Adjust the various display.
00241     if (m_text)
00242     {   
00243         m_text->setText (QString::number (inherited::value ()));
00244         m_text->setChanged (false);
00245     }
00246 
00247     if (m_slider)
00248     {
00249         disconnect (m_slider, SIGNAL (valueChanged (int)),
00250                     this, SLOT (sliderChanged (int)));
00251 
00252         m_slider->setValue (int (round ((inherited::value () - inherited::minValue ()) / m_smallStep)));
00253 
00254         connect (m_slider, SIGNAL (valueChanged (int)),
00255                  this, SLOT (sliderChanged (int)));
00256     }
00257 
00258     // Indicate where we are for various buttons and then set myself
00259     // dirty so they'll get updated.
00260     fwdEnable (inherited::maxValue () - inherited::value () >= m_smallStep);
00261     revEnable (inherited::value () - inherited::minValue () >= m_smallStep);
00262     setDirty ();
00263 }

template<class T>
void IgQtRangeControlImp< T >::sliderChanged ( int  newval  )  [inline, virtual]

Slider has changed to position value small steps from the minimum.

Adjust current control value.

Reimplemented from IgQtRangeControlCommon.

Definition at line 89 of file IgQtRangeControlImp.h.

Referenced by IgQtRangeControlImp< T >::setValue().

template<class T>
virtual T IgQtRangeControlImp< T >::stringToNumber ( const QString &   )  const [inline, virtual]

Reimplemented in IgQtRangeControlInt, IgQtRangeControlLong, IgQtRangeControlShort, IgQtRangeControlUInt, IgQtRangeControlULong, and IgQtRangeControlUShort.

Definition at line 31 of file IgQtRangeControlImp.h.

00032     { return (T)(0); }

template<class T>
virtual void IgQtRangeControlImp< T >::textChanged ( const QString &  newval  )  [inline, protected, virtual]

Reimplemented from IgQtRangeControlCommon.

Definition at line 167 of file IgQtRangeControlImp.h.

00168     { setValue (stringToNumber (newval)); }


Member Data Documentation

template<class T>
T IgQtRangeControlImp< T >::m_longStep [protected]

Definition at line 200 of file IgQtRangeControlImp.h.

template<class T>
T IgQtRangeControlImp< T >::m_smallStep [protected]

Definition at line 201 of file IgQtRangeControlImp.h.

Referenced by IgQtRangeControlImp< T >::initialize(), and IgQtRangeControlImp< T >::setValue().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:25:30 2009 for CMSSW by  doxygen 1.5.4