#include <Iguana/Controls/src/IgMatEdSlider.h>
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 |
IgMatEdMainWidget * | m_mainWidget |
QSlider * | m_slider |
float * | m_target |
bool | m_updatePosition |
Definition at line 23 of file IgMatEdSlider.h.
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 }
void IgMatEdSlider::setValue | ( | float | 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 }
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 }
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 }
QLabel* IgMatEdSlider::m_count [private] |
Definition at line 43 of file IgMatEdSlider.h.
Referenced by IgMatEdSlider(), updatePosition(), and updateValue().
QLabel* IgMatEdSlider::m_label [private] |
IgMatEdMainWidget* IgMatEdSlider::m_mainWidget [private] |
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] |