inputstring.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 _INPUTSTRING_H
16 #define _INPUTSTRING_H
17 
18 #include "input.h"
19 
20 #include <QObject>
21 #include <QMap>
22 #include <QStringList>
23 
24 class QLabel;
25 class QLineEdit;
26 class QToolBar;
27 class QComboBox;
28 class QGridLayout;
29 
30 class InputString : public QObject, public Input
31 {
32  Q_OBJECT
33 
34  public:
40  };
41 
42  InputString( QGridLayout *layout,int &row,
43  const QString &id, const QString &s,
44  StringMode m,
45  const QString &docs,
46  const QString &absPath = QString() );
47  ~InputString();
48  void addValue(QString s);
49  void setDefault();
50 
51  // Input
52  QVariant &value();
53  void update();
54  Kind kind() const { return String; }
55  QString docs() const { return m_docs; }
56  QString id() const { return m_id; }
57  QString templateDocs() const { return m_tdocs; }
58  void addDependency(Input *) { Q_ASSERT(false); }
59  void setEnabled(bool);
61  void writeValue(QTextStream &t,QTextCodec *codec);
62  void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
63 
64  public slots:
65  void reset();
66  void setValue(const QString&);
67 
68  signals:
69  void changed();
70  void showHelp(Input *);
71 
72  private slots:
73  void browse();
74  void clear();
75  void help();
76 
77  private:
78  void updateDefault();
79  QLabel *m_lab;
80  QLineEdit *m_le;
81  QLabel *m_im;
82  QToolBar *m_br;
83  QComboBox *m_com;
88  int m_index;
89  QVariant m_value;
92  bool m_absPath;
94 };
95 
96 #endif
void addValue(QString s)
void setEnabled(bool)
QVariant & value()
void setValue(const QString &)
QString id() const
Definition: inputstring.h:56
void showHelp(Input *)
QString m_docs
Definition: inputstring.h:90
void changed()
void updateDefault()
QString m_str
Definition: inputstring.h:84
QString m_tdocs
Definition: inputstring.h:93
QLineEdit * m_le
Definition: inputstring.h:80
QToolBar * m_br
Definition: inputstring.h:82
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
void writeValue(QTextStream &t, QTextCodec *codec)
QString docs() const
Definition: inputstring.h:55
void setTemplateDocs(const QString &docs)
Definition: inputstring.h:62
void updateDependencies()
Definition: inputstring.h:60
QLabel * m_im
Definition: inputstring.h:81
QString m_id
Definition: inputstring.h:91
A list of strings.
Definition: qstringlist.h:51
QString m_default
Definition: inputstring.h:85
bool m_absPath
Definition: inputstring.h:92
QComboBox * m_com
Definition: inputstring.h:83
QVariant m_value
Definition: inputstring.h:89
QString templateDocs() const
Definition: inputstring.h:57
Definition: input.h:9
void setDefault()
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
Kind
Definition: input.h:12
StringMode m_sm
Definition: inputstring.h:86
QLabel * m_lab
Definition: inputstring.h:79
Provides conversion between text encodings.
Definition: qtextcodec.h:62
QStringList m_values
Definition: inputstring.h:87
InputString(QGridLayout *layout, int &row, const QString &id, const QString &s, StringMode m, const QString &docs, const QString &absPath=QString())
Definition: inputstring.cpp:39
static QCString * s
Definition: config.cpp:1042
void addDependency(Input *)
Definition: inputstring.h:58
Kind kind() const
Definition: inputstring.h:54