inputint.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby
9  * granted. No representations are made about the suitability of this software
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  */
14 
15 #ifndef _INPUTINT_H
16 #define _INPUTINT_H
17 
18 #include "input.h"
19 #include <QObject>
20 
21 class QGridLayout;
22 class QLabel;
23 class QSpinBox;
24 
25 class InputInt : public QObject, public Input
26 {
27  Q_OBJECT
28 
29  public:
30  InputInt( QGridLayout *layout,int &row,
31  const QString &id, int defVal,
32  int minVal, int maxVal,
33  const QString &docs );
34  ~InputInt(){};
35 
36  // Input
37  QVariant &value();
38  void update();
39  Kind kind() const { return Int; }
40  QString docs() const { return m_docs; }
41  QString id() const { return m_id; }
42  QString templateDocs() const { return m_tdocs; }
43  void addDependency(Input *) { Q_ASSERT(false); }
44  void setEnabled(bool);
46  void writeValue(QTextStream &t,QTextCodec *codec);
47  void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
48 
49  public slots:
50  void reset();
51  void setValue(int val);
52 
53  private slots:
54  void help();
55 
56  signals:
57  void changed();
58  void showHelp(Input *);
59 
60  private:
61  void updateDefault();
62  QLabel *m_lab;
63  QSpinBox *m_sp;
64  int m_val;
65  int m_default;
66  int m_minVal;
67  int m_maxVal;
68  QVariant m_value;
72 };
73 
74 #endif
QString m_docs
Definition: inputint.h:69
QString m_tdocs
Definition: inputint.h:71
void updateDependencies()
Definition: inputint.h:45
int m_maxVal
Definition: inputint.h:67
void writeValue(QTextStream &t, QTextCodec *codec)
Definition: inputint.cpp:112
QVariant & value()
Definition: inputint.cpp:97
void reset()
Definition: inputint.cpp:107
void setEnabled(bool)
Definition: inputint.cpp:90
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QString templateDocs() const
Definition: inputint.h:42
QVariant m_value
Definition: inputint.h:68
QString id() const
Definition: inputint.h:41
QSpinBox * m_sp
Definition: inputint.h:63
void showHelp(Input *)
QString docs() const
Definition: inputint.h:40
void setTemplateDocs(const QString &docs)
Definition: inputint.h:47
void updateDefault()
Definition: inputint.cpp:75
QString m_id
Definition: inputint.h:70
int m_minVal
Definition: inputint.h:66
int m_default
Definition: inputint.h:65
Definition: input.h:9
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
~InputInt()
Definition: inputint.h:34
Kind
Definition: input.h:12
void changed()
QLabel * m_lab
Definition: inputint.h:62
void addDependency(Input *)
Definition: inputint.h:43
int m_val
Definition: inputint.h:64
void help()
Definition: inputint.cpp:56
Kind kind() const
Definition: inputint.h:39
Provides conversion between text encodings.
Definition: qtextcodec.h:62
void update()
Definition: inputint.cpp:102
InputInt(QGridLayout *layout, int &row, const QString &id, int defVal, int minVal, int maxVal, const QString &docs)
Definition: inputint.cpp:32
void setValue(int val)
Definition: inputint.cpp:62