Scribus
Open source desktop publishing at your fingertips
scrspinbox.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  * Craig Bradney, cbradney@zip.com.au *
9  ***************************************************************************/
10 
11 #ifndef SCRSPINBOX
12 #define SCRSPINBOX
13 
14 #include <QDoubleSpinBox>
15 #include <QLineEdit>
16 #include <QWidget>
17 
18 #include "scribusapi.h"
19 
21 class SCRIBUS_API ScrSpinBox : public QDoubleSpinBox
22 {
23  Q_OBJECT
24  public:
25  ScrSpinBox(QWidget *parent, int unitIndex=0);
26  ScrSpinBox(double minValue, double maxValue, QWidget *pa, int unitIndex=0);
27  ~ScrSpinBox();
28 
29  //overridden members
30  double valueFromText ( const QString & text ) const;
31  QString textFromValue ( double value ) const;
32  QValidator::State validate ( QString & input, int & pos ) const;
33  void fixup ( QString & input ) const;
34 
35  // call QDoubleSpinBox::setValue() without emitting valueChanged() signal
36  void showValue(double val);
37 
38  //custom
39  void init(int unitIndex);
40  void setConstants(const QMap<QString, double>* constants);
41  void setNewUnit(int unitIndex);
42  double getValue(int unitIndex=0);
43  void setTabAdvance(bool enable);
44 
45  uint unitIndex() const { return m_unitIndex; }
46  double unitRatio() const;
47 
48  public slots:
49  void setValues(double min, double max, int deci, double val);
50  void getValues(double *min, double *max, int *deci, double *val);
51  void setValue(int val);
52  void setValue(double val);
53 
54  protected:
55  void setParameters( int s );
56  uint m_unitIndex;
57  bool m_tabAdvance;
58  const QMap<QString, double>* m_constants;
59  bool eventFilter ( QObject * watched, QEvent * event );
60 
61  protected slots:
62  void textChanged();
63 
64 };
65 #endif
ScrSpinBox is a Qt4 replacement for our old ScrSpinBox using Qt3.
Definition: scrspinbox.h:21