![]() |
![]() |
#include <Iguana/GLBrowsers/interface/Ig3DMStringControl.h>
Public Slots | |
virtual void | newIndex (int) |
virtual void | setValue (unsigned int size, const SbString *newval) |
Public Member Functions | |
SoMFString * | field (void) const |
const SbString * | fieldValue (void) const |
Ig3DMStringControl (IgControlCategory *pane, QString label) | |
virtual void | resize (unsigned int size) |
void | setField (SoMFString *field) |
const SbString * | value (void) const |
QWidget * | widget (void) const |
Protected Member Functions | |
virtual void | applyValue (void) |
virtual void | updateValue (void) |
Private Slots | |
void | textChanged (const QString &newvalue) |
Private Attributes | |
QComboBox * | m_indexs |
IgQtLineEdit * | m_lineEdit |
std::vector< SbString > | m_strings |
QWidget * | m_value |
Definition at line 22 of file Ig3DMStringControl.h.
Ig3DMStringControl::Ig3DMStringControl | ( | IgControlCategory * | pane, | |
QString | label | |||
) |
Definition at line 24 of file Ig3DMStringControl.cc.
References reco::fitHelper::add(), IgControlBase::addGridWidget(), ASSERT, IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), HLT_VtxMuL3::connect, IgControlItem::editable(), IgControlBase::gridRows(), edm::es::l(), m_indexs, m_lineEdit, m_value, IgControlBase::makeIndentedLabel(), IgControlItem::makeSpacedBox(), newIndex(), row, and textChanged().
00026 : Ig3DFieldControl (pane), 00027 m_value (0), 00028 m_indexs (0), 00029 m_strings (1, SbString ("")) 00030 { 00031 ASSERT (pane); 00032 ASSERT (pane->bodyArea ()); 00033 ASSERT (pane->bodyLayout ()); 00034 00035 QWidget *area = pane->bodyArea (); 00036 int row = gridRows (); 00037 00038 ASSERT (row >= 0); 00039 00040 // Add a new row to the grid, label on the left and the value on the right 00041 QWidget *vlab = makeIndentedLabel (label, area); 00042 addGridWidget (vlab, row, 0); 00043 QWhatsThis::add (vlab, "String values"); 00044 00045 m_value = new QWidget(area); 00046 QHBoxLayout *l = new QHBoxLayout (m_value, 0, 5); 00047 l->addItem ( new QSpacerItem( 50, 20, QSizePolicy::Expanding, 00048 QSizePolicy::Minimum )); 00049 00050 m_indexs = new QComboBox (m_value); 00051 l->addWidget (m_indexs); 00052 m_indexs->insertItem ("0"); 00053 m_indexs->setCurrentItem (0); 00054 m_indexs->hide (); 00055 QWhatsThis::add (m_indexs, "Select the index"); 00056 l->addItem ( new QSpacerItem( 50, 20, QSizePolicy::Expanding, 00057 QSizePolicy::Minimum )); 00058 00059 m_lineEdit = new IgQtLineEdit (m_value); 00060 QWhatsThis::add (m_lineEdit, "String values"); 00061 l->addWidget (m_lineEdit); 00062 00063 addGridWidget (makeSpacedBox (area, m_value), row, 1); 00064 00065 // Link the button press signal to popping up a color dialog 00066 connect (m_indexs, SIGNAL (activated (int)), 00067 this, SLOT (newIndex (int))); 00068 connect (m_lineEdit, SIGNAL (valueChanged (const QString&)), 00069 this, SLOT (textChanged (const QString&))); 00070 connect (this, SIGNAL (editable (bool)), 00071 m_value, SLOT (setEnabled (bool))); 00072 connect (this, SIGNAL (editable (bool)), 00073 vlab, SLOT (setEnabled (bool))); 00074 }
Implements IgControlBase.
Definition at line 150 of file Ig3DMStringControl.cc.
References field(), m_strings, and value().
SoMFString * Ig3DMStringControl::field | ( | void | ) | const |
Reimplemented from Ig3DFieldControl.
Definition at line 78 of file Ig3DMStringControl.cc.
References Ig3DFieldControl::field().
Referenced by applyValue(), fieldValue(), and updateValue().
00079 { return static_cast<SoMFString *> (Ig3DFieldControl::field ()); }
const SbString * Ig3DMStringControl::fieldValue | ( | void | ) | const |
Definition at line 86 of file Ig3DMStringControl.cc.
References ASSERT, and field().
Referenced by updateValue().
Definition at line 154 of file Ig3DMStringControl.cc.
References getString(), m_lineEdit, and m_strings.
Referenced by Ig3DMStringControl().
00155 { m_lineEdit->setText (m_strings[index].getString ()); }
Definition at line 99 of file Ig3DMStringControl.cc.
References ASSERT, i, m_indexs, and m_strings.
Referenced by setValue().
00100 { 00101 ASSERT (size); 00102 int sizeDiff = size - m_strings.size (); 00103 if (sizeDiff == 0) return; 00104 00105 m_strings.resize (size); 00106 if (sizeDiff > 0) 00107 { 00108 for (unsigned int i = size - sizeDiff; i < size; i++) 00109 m_indexs->insertItem (QString::number (i)); 00110 } 00111 else { 00112 for (unsigned int i = size - sizeDiff - 1 ; i >= size; i--) 00113 m_indexs->removeItem (i); 00114 } 00115 00116 if (size > 1) 00117 m_indexs->show (); 00118 else 00119 m_indexs->hide (); 00120 }
void Ig3DMStringControl::setField | ( | SoMFString * | field | ) |
Definition at line 82 of file Ig3DMStringControl.cc.
References Ig3DFieldControl::setField().
00083 { Ig3DFieldControl::setField (field); }
Definition at line 123 of file Ig3DMStringControl.cc.
References getString(), i, index, m_indexs, m_lineEdit, m_strings, resize(), and IgControlItem::setDirty().
Referenced by updateValue().
00124 { 00125 int index = m_indexs->currentItem (); 00126 if (index < 0) 00127 index = 0; 00128 00129 resize (size); 00130 for (unsigned int i = 0; i < size; i++) 00131 m_strings [i] = newval [i]; 00132 00133 m_indexs->setCurrentItem (index); 00134 m_lineEdit->setText (newval [index].getString ()); 00135 setDirty (); 00136 }
void Ig3DMStringControl::textChanged | ( | const QString & | newvalue | ) | [private, slot] |
Definition at line 139 of file Ig3DMStringControl.cc.
References m_indexs, m_strings, and IgControlItem::setDirty().
Referenced by Ig3DMStringControl().
Implements IgControlBase.
Definition at line 146 of file Ig3DMStringControl.cc.
References field(), fieldValue(), and setValue().
00147 { setValue (static_cast<SoMFString *>(field())->getNum (), fieldValue ()); }
const SbString * Ig3DMStringControl::value | ( | void | ) | const |
Definition at line 95 of file Ig3DMStringControl.cc.
References m_strings.
Referenced by applyValue().
00096 { return &(m_strings[0]); }
QWidget * Ig3DMStringControl::widget | ( | void | ) | const |
QComboBox* Ig3DMStringControl::m_indexs [private] |
Definition at line 54 of file Ig3DMStringControl.h.
Referenced by Ig3DMStringControl(), resize(), setValue(), and textChanged().
IgQtLineEdit* Ig3DMStringControl::m_lineEdit [private] |
Definition at line 53 of file Ig3DMStringControl.h.
Referenced by Ig3DMStringControl(), newIndex(), and setValue().
std::vector<SbString> Ig3DMStringControl::m_strings [private] |
Definition at line 55 of file Ig3DMStringControl.h.
Referenced by applyValue(), newIndex(), resize(), setValue(), textChanged(), and value().
QWidget* Ig3DMStringControl::m_value [private] |
Definition at line 52 of file Ig3DMStringControl.h.
Referenced by Ig3DMStringControl(), and widget().