lib
spinbox.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KPROPERTY_SPINBOX_H
00022 #define KPROPERTY_SPINBOX_H
00023
00024 #include <knuminput.h>
00025
00026 #include "../widget.h"
00027
00028 namespace KoProperty {
00029
00030 class IntEdit;
00031 class DoubleEdit;
00032
00033
00034
00035 class IntSpinBox : public KIntSpinBox
00036 {
00037 Q_OBJECT
00038
00039 public:
00040 IntSpinBox(int lower, int upper, int step, int value, int base=10,
00041 IntEdit *parent=0, const char *name=0);
00042 virtual ~IntSpinBox() {;}
00043
00044 virtual bool eventFilter(QObject *o, QEvent *e);
00045 QLineEdit * editor () const { return KIntSpinBox::editor(); }
00046 };
00047
00048 class KOPROPERTY_EXPORT IntEdit : public Widget
00049 {
00050 Q_OBJECT
00051
00052 public:
00053 IntEdit(Property *property, QWidget *parent=0, const char *name=0);
00054 virtual ~IntEdit();
00055
00056 virtual QVariant value() const;
00057 virtual void setValue(const QVariant &value, bool emitChange=true);
00058 virtual void drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value);
00059
00060 protected:
00061 virtual void setReadOnlyInternal(bool readOnly);
00062 void updateSpinWidgets();
00063
00064 protected slots:
00065 void slotValueChanged(int value);
00066
00067 private:
00068 IntSpinBox *m_edit;
00069 };
00070
00071
00072
00073 class DoubleSpinBox : public KDoubleSpinBox
00074 {
00075 Q_OBJECT
00076
00077 public:
00079 DoubleSpinBox(double lower, double upper, double step, double value=0,
00080 int precision=2, DoubleEdit *parent=0);
00081 virtual ~DoubleSpinBox() {;}
00082
00083 virtual bool eventFilter(QObject *o, QEvent *e);
00084 QLineEdit * editor () const { return KDoubleSpinBox::editor(); }
00085
00086 public slots:
00087 virtual void setValue ( double value );
00088 };
00089
00090 class KOPROPERTY_EXPORT DoubleEdit : public Widget
00091 {
00092 Q_OBJECT
00093
00094 public:
00095 DoubleEdit(Property *property, QWidget *parent=0, const char *name=0);
00096 virtual ~DoubleEdit();
00097
00098 virtual QVariant value() const;
00099 virtual void setValue(const QVariant &value, bool emitChange=true);
00100 virtual void drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value);
00101
00102 protected:
00103 virtual void setReadOnlyInternal(bool readOnly);
00104 void updateSpinWidgets();
00105
00106 protected slots:
00107 void slotValueChanged(double value);
00108
00109 private:
00110 DoubleSpinBox *m_edit;
00111 };
00112
00113 }
00114
00115 #endif
|