CMS 3D CMS Logo

IgMatEdSlider Class Reference

#include <Iguana/Controls/src/IgMatEdSlider.h>

List of all members.

Public Slots

void updateValue (int newValue)

Public Member Functions

 IgMatEdSlider (QWidget *parent, const char *name, float *target, IgMatEdMainWidget *mainWidget)
void setValue (float value)
void setValue (int value)
void updatePosition (float value)
void updatePosition (int value)

Private Attributes

QLabel * m_count
QLabel * m_label
IgMatEdMainWidgetm_mainWidget
QSlider * m_slider
float * m_target
bool m_updatePosition


Detailed Description

Definition at line 23 of file IgMatEdSlider.h.


Constructor & Destructor Documentation

IgMatEdSlider::IgMatEdSlider ( QWidget *  parent,
const char *  name,
float *  target,
IgMatEdMainWidget mainWidget 
)

Definition at line 27 of file IgMatEdSlider.cc.

References ASSERT, HLT_VtxMuL3::connect, m_count, m_label, m_mainWidget, m_slider, m_target, updateValue(), and width.

00028     :QHBox (parent),
00029      m_target (target),
00030      m_mainWidget (mainWidget),
00031      m_updatePosition (false)
00032 {
00033     ASSERT (m_target);
00034     ASSERT (m_mainWidget);
00035 
00036     this->setSpacing (2);
00037     this->setMargin (2);
00038 
00039     m_label = new QLabel (name,this);
00040     m_slider = new QSlider (0, 100, 1, 0, Qt::Horizontal, this);
00041     m_slider->setTickmarks (QSlider::Below);
00042     m_slider->setValue ((int) ((*target)*100));    
00043     m_slider->setTickInterval (10);
00044     
00045     m_count = new QLabel (QString::number ((*target)*100) + "%",this);
00046     
00047     /*Makes sure that labels and count are aligned*/
00048     m_label->setMinimumWidth (QApplication::fontMetrics ().width ("Green")+10);    
00049     m_count->setMinimumWidth (QApplication::fontMetrics ().width ("100%")+10);    
00050 
00051     connect (m_slider, SIGNAL (valueChanged (int)), this, SLOT (updateValue (int)));    
00052 }


Member Function Documentation

void IgMatEdSlider::setValue ( float  value  ) 

Definition at line 75 of file IgMatEdSlider.cc.

References m_slider.

00076 {
00077     m_slider->setValue ((int)(100*value));    
00078 }

void IgMatEdSlider::setValue ( int  value  ) 

Definition at line 68 of file IgMatEdSlider.cc.

References m_slider, and updateValue().

Referenced by IgMatEdColorBox::setColor().

00069 {
00070     m_slider->setValue (value);
00071     updateValue (value);    
00072 }

void IgMatEdSlider::updatePosition ( float  value  ) 

Definition at line 91 of file IgMatEdSlider.cc.

References m_count, m_slider, m_target, and m_updatePosition.

00092 {
00093     m_updatePosition = true;    
00094     *m_target = newValue;
00095     m_count->setText (QString::number ((int) (100*newValue)) + "%");    
00096     m_slider->setValue ((int) (100*newValue));    
00097     m_updatePosition = false;    
00098 }

void IgMatEdSlider::updatePosition ( int  value  ) 

Definition at line 81 of file IgMatEdSlider.cc.

References m_count, m_slider, m_target, and m_updatePosition.

Referenced by IgMatEdMainWidget::newMaterial(), and IgMatEdColorBox::updatePosition().

00082 {
00083     m_updatePosition = true;    
00084     *m_target = ((float) newValue)/100;
00085     m_count->setText (QString::number (newValue) + "%");    
00086     m_slider->setValue (newValue);    
00087     m_updatePosition = false;    
00088 }

void IgMatEdSlider::updateValue ( int  newValue  )  [slot]

Definition at line 55 of file IgMatEdSlider.cc.

References cmsRelvalreport::action, IgMatEdMainWidget::m_comboBox, m_count, m_mainWidget, IgMatEdMainWidget::m_soMaterialMap, m_target, and m_updatePosition.

Referenced by IgMatEdSlider(), and setValue().

00056 {
00057         *m_target = ((float) newValue)/100;
00058         m_count->setText (QString::number (newValue) + "%");    
00059         IgMatEdModificationAction *action = new IgMatEdModificationAction ();
00060         //action->apply ((SoNode *) m_mainWidget->m_currentMaterial);
00061         if (m_updatePosition == false)
00062         {
00063             action->apply ((SoNode *) (*(m_mainWidget->m_soMaterialMap))[m_mainWidget->m_comboBox->currentText ()]);        
00064         }       
00065 }


Member Data Documentation

QLabel* IgMatEdSlider::m_count [private]

Definition at line 43 of file IgMatEdSlider.h.

Referenced by IgMatEdSlider(), updatePosition(), and updateValue().

QLabel* IgMatEdSlider::m_label [private]

Definition at line 39 of file IgMatEdSlider.h.

Referenced by IgMatEdSlider().

IgMatEdMainWidget* IgMatEdSlider::m_mainWidget [private]

Definition at line 42 of file IgMatEdSlider.h.

Referenced by IgMatEdSlider(), and updateValue().

QSlider* IgMatEdSlider::m_slider [private]

Definition at line 40 of file IgMatEdSlider.h.

Referenced by IgMatEdSlider(), setValue(), and updatePosition().

float* IgMatEdSlider::m_target [private]

Definition at line 41 of file IgMatEdSlider.h.

Referenced by IgMatEdSlider(), updatePosition(), and updateValue().

bool IgMatEdSlider::m_updatePosition [private]

Definition at line 44 of file IgMatEdSlider.h.

Referenced by updatePosition(), and updateValue().


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