inputbool.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 _INPUTBOOL_H
16 #define _INPUTBOOL_H
17 
18 #include "input.h"
19 #include <QObject>
20 
21 class QCheckBox;
22 class QGridLayout;
23 class QLabel;
24 
25 class InputBool : public QObject, public Input
26 {
27  Q_OBJECT
28 
29  public:
30  InputBool(QGridLayout *layout,int &row,const QString &id,
31  bool enabled, const QString &docs );
32 
33  // Input
34  QVariant &value();
35  void update();
36  Kind kind() const { return Bool; }
37  QString docs() const { return m_docs; }
38  QString id() const { return m_id; }
39  QString templateDocs() const { return m_tdocs; }
40  void addDependency(Input *option) { m_dependencies+=option; }
41  void setEnabled(bool);
42  void updateDependencies();
43  void writeValue(QTextStream &t,QTextCodec *codec);
44  void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
45 
46  public slots:
47  void reset();
48  void setValue(bool);
49 
50  signals:
51  void changed();
52  void toggle(QString,bool);
53  void showHelp(Input *);
54 
55  private slots:
56  void help();
57 
58  private:
59  void updateDefault();
60  bool m_state;
61  bool m_default;
62  bool m_enabled;
63  QVariant m_value;
64  QCheckBox *m_cb;
68  QLabel *m_lab;
70 };
71 
72 #endif
QString m_docs
Definition: inputbool.h:65
void setEnabled(bool)
Definition: inputbool.cpp:46
void setTemplateDocs(const QString &docs)
Definition: inputbool.h:44
void help()
Definition: inputbool.cpp:41
QString id() const
Definition: inputbool.h:38
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: inputbool.h:39
QLabel * m_lab
Definition: inputbool.h:68
bool m_state
Definition: inputbool.h:60
QCheckBox * m_cb
Definition: inputbool.h:64
bool m_enabled
Definition: inputbool.h:62
void writeValue(QTextStream &t, QTextCodec *codec)
Definition: inputbool.cpp:109
QVariant & value()
Definition: inputbool.cpp:88
void setValue(bool)
Definition: inputbool.cpp:63
void updateDependencies()
Definition: inputbool.cpp:55
QString docs() const
Definition: inputbool.h:37
void toggle(QString, bool)
void changed()
void update()
Definition: inputbool.cpp:93
void showHelp(Input *)
QString m_tdocs
Definition: inputbool.h:69
Definition: input.h:9
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
QList< Input * > m_dependencies
Definition: inputbool.h:66
bool m_default
Definition: inputbool.h:61
Kind kind() const
Definition: inputbool.h:36
Kind
Definition: input.h:12
void reset()
Definition: inputbool.cpp:104
QString m_id
Definition: inputbool.h:67
void updateDefault()
Definition: inputbool.cpp:76
Provides conversion between text encodings.
Definition: qtextcodec.h:62
void addDependency(Input *option)
Definition: inputbool.h:40
QVariant m_value
Definition: inputbool.h:63
InputBool(QGridLayout *layout, int &row, const QString &id, bool enabled, const QString &docs)
Definition: inputbool.cpp:23