Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
InputInt Class Reference

#include <inputint.h>

Inheritance diagram for InputInt:
Input

Public Slots

void reset ()
 
void setValue (int val)
 

Signals

void changed ()
 
void showHelp (Input *)
 

Public Member Functions

 InputInt (QGridLayout *layout, int &row, const QString &id, int defVal, int minVal, int maxVal, const QString &docs)
 
 ~InputInt ()
 
QVariant & value ()
 
void update ()
 
Kind kind () const
 
QString docs () const
 
QString id () const
 
QString templateDocs () const
 
void addDependency (Input *)
 
void setEnabled (bool)
 
void updateDependencies ()
 
void writeValue (QTextStream &t, QTextCodec *codec)
 
void setTemplateDocs (const QString &docs)
 
- Public Member Functions inherited from Input
virtual ~Input ()
 
virtual void reset ()=0
 

Private Slots

void help ()
 

Private Member Functions

void updateDefault ()
 

Private Attributes

QLabel * m_lab
 
QSpinBox * m_sp
 
int m_val
 
int m_default
 
int m_minVal
 
int m_maxVal
 
QVariant m_value
 
QString m_docs
 
QString m_id
 
QString m_tdocs
 

Additional Inherited Members

- Public Types inherited from Input
enum  Kind {
  Bool, Int, String, StrList,
  Obsolete
}
 

Detailed Description

Definition at line 25 of file inputint.h.

Constructor & Destructor Documentation

InputInt::InputInt ( QGridLayout *  layout,
int &  row,
const QString id,
int  defVal,
int  minVal,
int  maxVal,
const QString docs 
)

Definition at line 32 of file inputint.cpp.

36  : m_default(defVal), m_minVal(minVal), m_maxVal(maxVal), m_docs(docs), m_id(id)
37 {
38  m_lab = new HelpLabel(id);
39  m_sp = new NoWheelSpinBox;
40  m_sp->setMinimum(minVal);
41  m_sp->setMaximum(maxVal);
42  m_sp->setSingleStep(1);
43  m_val=defVal-1; // force update
44  setValue(defVal);
45 
46  layout->addWidget( m_lab, row, 0 );
47  layout->addWidget( m_sp, row, 1 );
48 
49  connect(m_sp, SIGNAL(valueChanged(int)),
50  this, SLOT(setValue(int)) );
51  connect( m_lab, SIGNAL(enter()), SLOT(help()) );
52  connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
53  row++;
54 }
QString m_docs
Definition: inputint.h:69
int m_maxVal
Definition: inputint.h:67
void reset()
Definition: inputint.cpp:107
QSpinBox * m_sp
Definition: inputint.h:63
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
Definition: graph.py:30
QString m_id
Definition: inputint.h:70
int m_minVal
Definition: inputint.h:66
int m_default
Definition: inputint.h:65
QLabel * m_lab
Definition: inputint.h:62
int m_val
Definition: inputint.h:64
void help()
Definition: inputint.cpp:56
void setValue(int val)
Definition: inputint.cpp:62
InputInt::~InputInt ( )
inline

Definition at line 34 of file inputint.h.

34 {};

Member Function Documentation

void InputInt::addDependency ( Input )
inlinevirtual

Implements Input.

Definition at line 43 of file inputint.h.

43 { Q_ASSERT(false); }
void InputInt::changed ( )
signal
QString InputInt::docs ( ) const
inlinevirtual

Implements Input.

Definition at line 40 of file inputint.h.

40 { return m_docs; }
QString m_docs
Definition: inputint.h:69
void InputInt::help ( )
privateslot

Definition at line 56 of file inputint.cpp.

57 {
58  showHelp(this);
59 }
void showHelp(Input *)
QString InputInt::id ( ) const
inlinevirtual

Implements Input.

Definition at line 41 of file inputint.h.

41 { return m_id; }
QString m_id
Definition: inputint.h:70
Kind InputInt::kind ( ) const
inlinevirtual

Implements Input.

Definition at line 39 of file inputint.h.

39 { return Int; }
void InputInt::reset ( )
slot

Definition at line 107 of file inputint.cpp.

108 {
110 }
int m_default
Definition: inputint.h:65
void setValue(int val)
Definition: inputint.cpp:62
void InputInt::setEnabled ( bool  state)
virtual

Implements Input.

Definition at line 90 of file inputint.cpp.

91 {
92  m_lab->setEnabled(state);
93  m_sp->setEnabled(state);
94  updateDefault();
95 }
QSpinBox * m_sp
Definition: inputint.h:63
void updateDefault()
Definition: inputint.cpp:75
QLabel * m_lab
Definition: inputint.h:62
void InputInt::setTemplateDocs ( const QString docs)
inlinevirtual

Implements Input.

Definition at line 47 of file inputint.h.

47 { m_tdocs = docs; }
QString m_tdocs
Definition: inputint.h:71
QString docs() const
Definition: inputint.h:40
void InputInt::setValue ( int  val)
slot

Definition at line 62 of file inputint.cpp.

63 {
64  val = qMax(m_minVal,val);
65  val = qMin(m_maxVal,val);
66  if (val!=m_val)
67  {
68  m_val = val;
69  m_sp->setValue(val);
70  m_value = m_val;
71  updateDefault();
72  }
73 }
int m_maxVal
Definition: inputint.h:67
QVariant m_value
Definition: inputint.h:68
QSpinBox * m_sp
Definition: inputint.h:63
void updateDefault()
Definition: inputint.cpp:75
int m_minVal
Definition: inputint.h:66
int m_val
Definition: inputint.h:64
void InputInt::showHelp ( Input )
signal
QString InputInt::templateDocs ( ) const
inlinevirtual

Implements Input.

Definition at line 42 of file inputint.h.

42 { return m_tdocs; }
QString m_tdocs
Definition: inputint.h:71
void InputInt::update ( )
virtual

Implements Input.

Definition at line 102 of file inputint.cpp.

103 {
104  setValue(m_value.toInt());
105 }
QVariant m_value
Definition: inputint.h:68
void setValue(int val)
Definition: inputint.cpp:62
void InputInt::updateDefault ( )
private

Definition at line 75 of file inputint.cpp.

76 {
77  {
78  if (m_val==m_default || !m_lab->isEnabled())
79  {
80  m_lab->setText(QString::fromLatin1("<qt>")+m_id+QString::fromLatin1("</qt"));
81  }
82  else
83  {
84  m_lab->setText(QString::fromLatin1("<qt><font color='red'>")+m_id+QString::fromLatin1("</font></qt>"));
85  }
86  emit changed();
87  }
88 }
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
QString m_id
Definition: inputint.h:70
int m_default
Definition: inputint.h:65
void changed()
QLabel * m_lab
Definition: inputint.h:62
int m_val
Definition: inputint.h:64
void InputInt::updateDependencies ( )
inlinevirtual

Implements Input.

Definition at line 45 of file inputint.h.

45 {}
QVariant & InputInt::value ( )
virtual

Implements Input.

Definition at line 97 of file inputint.cpp.

98 {
99  return m_value;
100 }
QVariant m_value
Definition: inputint.h:68
void InputInt::writeValue ( QTextStream t,
QTextCodec codec 
)
virtual

Implements Input.

Definition at line 112 of file inputint.cpp.

113 {
114  t << m_val;
115 }
int m_val
Definition: inputint.h:64

Member Data Documentation

int InputInt::m_default
private

Definition at line 65 of file inputint.h.

QString InputInt::m_docs
private

Definition at line 69 of file inputint.h.

QString InputInt::m_id
private

Definition at line 70 of file inputint.h.

QLabel* InputInt::m_lab
private

Definition at line 62 of file inputint.h.

int InputInt::m_maxVal
private

Definition at line 67 of file inputint.h.

int InputInt::m_minVal
private

Definition at line 66 of file inputint.h.

QSpinBox* InputInt::m_sp
private

Definition at line 63 of file inputint.h.

QString InputInt::m_tdocs
private

Definition at line 71 of file inputint.h.

int InputInt::m_val
private

Definition at line 64 of file inputint.h.

QVariant InputInt::m_value
private

Definition at line 68 of file inputint.h.


The documentation for this class was generated from the following files: