CMS 3D CMS Logo

IgQtRangeSetting.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/GLBrowsers/interface/IgQtRangeSetting.h"
00004 #include <qlayout.h>
00005 #include <qlineedit.h>
00006 #include <qpushbutton.h>
00007 #include <qsizepolicy.h>
00008 #include <qlabel.h>
00009 
00010 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00011 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00012 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00013 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00014 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00015 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00016 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00017 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00018 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00019 
00020 IgQtRangeSetting::IgQtRangeSetting (QWidget* parent, const char* name, bool modal, WFlags fl)
00021     : QDialog (parent, name, modal, fl),
00022       m_valueChanged (false),
00023       m_rangeChanged (false),
00024       m_stepChanged (false),
00025       m_applied (false)
00026 {
00027     setCaption ("Range Controller");
00028     QVBoxLayout *m_layout1 = new QVBoxLayout (this, 10, 5, "m_layout1");    
00029     m_layout = new QGridLayout (m_layout1, 1, 1, 11, "m_layout");
00030     
00031     QLabel *value = new QLabel (this, "value");
00032     value->setText (tr ("Value"));
00033     m_value = new QLineEdit (this, "m_value");
00034     m_value->setAlignment (AlignRight);
00035     m_layout->addWidget (value, 0, 0);    
00036     m_layout->addWidget (m_value, 0, 1);
00037     
00038     QLabel *m_precisionLab = new QLabel (this, "precision");
00039     m_precisionLab->setText (tr ("Precision"));
00040     m_precision = new QLineEdit (this, "m_precision");
00041     m_precision->setAlignment (AlignRight);
00042     m_layout->addWidget (m_precisionLab, 0, 2);
00043     m_layout->addWidget (m_precision, 0, 3);
00044 
00045     QLabel *min = new QLabel (this, "min");
00046     min->setText (tr ("Minimum"));
00047     m_min = new QLineEdit (this, "m_min");
00048     m_min->setAlignment (AlignRight);
00049     m_layout->addWidget (min, 1, 0);    
00050     m_layout->addWidget (m_min, 1, 1);
00051     
00052     QLabel *max = new QLabel (this, "max");
00053     max->setText (tr ("Maximum"));
00054     m_max = new QLineEdit (this, "m_max");
00055     m_max->setAlignment (AlignRight);
00056     m_layout->addWidget (max, 1, 2);    
00057     m_layout->addWidget (m_max, 1, 3);
00058     
00059     QLabel *small = new QLabel (this, "small");
00060     small->setText (tr ("Small step"));
00061     m_small = new QLineEdit (this, "m_small");
00062     m_small->setAlignment (AlignRight);
00063     m_layout->addWidget (small, 2, 0);    
00064     m_layout->addWidget (m_small, 2, 1);
00065     
00066     QLabel *xlong = new QLabel (this, "long");
00067     xlong->setText (tr ("long step"));
00068     m_long = new QLineEdit (this, "m_long");
00069     m_long->setAlignment (AlignRight);
00070     m_layout->addWidget (xlong, 2, 2);    
00071     m_layout->addWidget (m_long, 2, 3);
00072     
00073     m_layout1->addItem (new QSpacerItem ( 50, 20, QSizePolicy::Minimum,
00074                                           QSizePolicy::Expanding));
00075                                                 
00076     QHBoxLayout *m_layout2 = new QHBoxLayout (m_layout1, 5, "m_layout2");
00077     m_cancel = new QPushButton ("&Cancel", this, "m_cancel");
00078     
00079     m_ok = new QPushButton ("&Ok", this, "m_ok");
00080     m_ok->setEnabled (true);
00081     m_ok->setDefault (true);
00082     
00083     m_layout2->addItem (new QSpacerItem (50, 20, QSizePolicy::Expanding,
00084                                          QSizePolicy::Minimum));
00085     m_layout2->addWidget (m_ok);
00086     m_layout2->addItem (new QSpacerItem (50, 20, QSizePolicy::Expanding,
00087                                          QSizePolicy::Minimum));
00088     m_layout2->addWidget (m_cancel);
00089     m_layout2->addItem (new QSpacerItem (50, 20, QSizePolicy::Expanding,
00090                                          QSizePolicy::Minimum));
00091     
00092     clear  ();
00093     enablePrecision (false);
00094     setModal (true);
00095     hide ();
00096     connect (m_cancel, SIGNAL (clicked ()), this, SLOT (cancel ()));
00097     connect (m_ok, SIGNAL (clicked ()), this, SLOT (apply ()));
00098     connect (m_value, SIGNAL (textChanged (const QString &)),
00099              this, SLOT (valueChanged (const QString &)));
00100     connect (m_min, SIGNAL (textChanged (const QString &)),
00101              this, SLOT (rangeChanged (const QString &)));
00102     connect (m_max, SIGNAL (textChanged (const QString &)),
00103              this, SLOT (rangeChanged (const QString &)));
00104     connect (m_small, SIGNAL (textChanged (const QString &)),
00105              this, SLOT (stepChanged (const QString &)));
00106     connect (m_long, SIGNAL (textChanged (const QString &)),
00107              this, SLOT (stepChanged(const QString &)));
00108     connect (m_precision, SIGNAL (textChanged (const QString &)),
00109              this, SLOT (precisionChanged (const QString &)));
00110 }
00111 
00112 void
00113 IgQtRangeSetting::clear (void)
00114 {
00115     m_valueChanged = false;
00116     m_rangeChanged = false;
00117     m_stepChanged = false;
00118     m_precisionChanged = false;
00119     m_applied = false;
00120 }
00121 
00122 void
00123 IgQtRangeSetting::apply (void)
00124 {
00125     m_applied = true;
00126     close ();
00127 }
00128 
00129 void
00130 IgQtRangeSetting::cancel (void)
00131 {
00132     clear ();
00133     close ();
00134 }
00135 
00136 void
00137 IgQtRangeSetting::enablePrecision (bool enable /*=true*/)
00138 { m_precision->setEnabled (enable); }
00139 
00140 void
00141 IgQtRangeSetting::enableStep (bool enable /*=true*/)
00142 { m_small->setEnabled (enable); m_long->setEnabled (enable); }
00143 
00144 void
00145 IgQtRangeSetting::enableRange (bool enable /*=true*/)
00146 { m_min->setEnabled (enable); m_max->setEnabled (enable); }
00147 
00148 void
00149 IgQtRangeSetting::enableValue (bool enable /*=true*/)
00150 { m_value->setEnabled (enable); }
00151 
00152 void
00153 IgQtRangeSetting::valueChanged (const QString & /*newvalue*/)
00154 { m_valueChanged = true; }
00155 
00156 void
00157 IgQtRangeSetting::rangeChanged (const QString & /*newvalue*/)
00158 { m_rangeChanged = true; }
00159 
00160 void
00161 IgQtRangeSetting::stepChanged (const QString & /*newvalue*/)
00162 { m_stepChanged = true; }
00163 
00164 void
00165 IgQtRangeSetting::precisionChanged (const QString & /*newvalue*/)
00166 { m_precisionChanged = true; }
00167 
00168 bool
00169 IgQtRangeSetting::isValueChanged (void) const
00170 { return m_valueChanged; }
00171 
00172 bool
00173 IgQtRangeSetting::isRangeChanged (void) const
00174 { return m_rangeChanged; }
00175 
00176 bool
00177 IgQtRangeSetting::isStepChanged (void) const
00178 { return m_stepChanged; }
00179 
00180 bool
00181 IgQtRangeSetting::isPrecisionChanged (void) const
00182 { return m_precisionChanged; }
00183 
00184 bool
00185 IgQtRangeSetting::isApplied (void) const
00186 { return m_applied; }
00187 
00188 QString
00189 IgQtRangeSetting::getValue (void) const
00190 { return m_value->text (); }
00191 
00192 QString
00193 IgQtRangeSetting::getMin (void) const
00194 { return m_min->text (); }
00195 
00196 QString
00197 IgQtRangeSetting::getMax (void) const
00198 { return m_max->text (); }
00199 
00200 QString
00201 IgQtRangeSetting::getSmall (void) const
00202 { return m_small->text (); }
00203 
00204 QString
00205 IgQtRangeSetting::getLong (void) const
00206 { return m_long->text (); }
00207 
00208 QString
00209 IgQtRangeSetting::getPrecision (void) const
00210 { return m_precision->text (); }
00211 
00212 void
00213 IgQtRangeSetting::setValue (const QString& val)
00214 { m_value->setText (val); }
00215 
00216 void
00217 IgQtRangeSetting::setRange (const QString& min, const QString& max)
00218 { setMin (min); setMax (max); }
00219 
00220 void
00221 IgQtRangeSetting::setMin (const QString& val)
00222 { m_min->setText (val); }
00223 
00224 void
00225 IgQtRangeSetting::setMax (const QString& val)
00226 { m_max->setText (val); }
00227 
00228 void
00229 IgQtRangeSetting::setStep (const QString& smallStep, const QString& longStep)
00230 { setSmall (smallStep); setLong (longStep); }
00231 
00232 void
00233 IgQtRangeSetting::setSmall (const QString& val)
00234 { m_small->setText (val); }
00235 
00236 void
00237 IgQtRangeSetting::setLong (const QString& val)
00238 { m_long->setText (val); }
00239 
00240 void
00241 IgQtRangeSetting::setPrecision (const QString& val)
00242 { m_precision->setText (val); }
00243 

Generated on Tue Jun 9 17:38:39 2009 for CMSSW by  doxygen 1.5.4