inputint.h 1.76 KB
Newer Older
1 2
/******************************************************************************
 *
3
 * 
4
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
5
 * Copyright (C) 1997-2014 by Dimitri van Heesch.
6 7 8 9 10 11 12 13 14 15 16 17
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 */

#ifndef _INPUTINT_H
#define _INPUTINT_H

18
#include "input.h"
19
#include <QObject>
20

21
class QGridLayout;
22 23 24
class QLabel;
class QSpinBox;

25
class InputInt : public QObject, public Input
26 27 28 29
{
  Q_OBJECT

  public:
30 31 32 33
    InputInt( QGridLayout *layout,int &row,
              const QString &id, int defVal, 
              int minVal, int maxVal,
              const QString &docs );
34
    ~InputInt(){};
35 36 37 38 39 40 41

    // Input
    QVariant &value();
    void update();
    Kind kind() const { return Int; }
    QString docs() const { return m_docs; }
    QString id() const { return m_id; }
42
    QString templateDocs() const { return m_tdocs; }
43
    void addDependency(Input *) { Q_ASSERT(false); }
44
    void setEnabled(bool);
45 46
    void updateDependencies() {}
    void writeValue(QTextStream &t,QTextCodec *codec);
47
    void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
48

49 50 51 52 53 54
  public slots:
    void reset();
    void setValue(int val); 

  private slots:
    void help();
55 56 57

  signals:
    void changed();
58
    void showHelp(Input *);
59

60
  private:
61
    void updateDefault();
62 63 64 65 66 67 68 69 70
    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;
71
    QString   m_tdocs;
72 73 74
};

#endif