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 void setValue(const QVariant &value);
00045
00046 virtual bool eventFilter(QObject *o, QEvent *e);
00047 QLineEdit * editor () const { return KIntSpinBox::editor(); }
00048 };
00049
00050 class KOPROPERTY_EXPORT IntEdit : public Widget
00051 {
00052 Q_OBJECT
00053
00054 public:
00055 IntEdit(Property *property, QWidget *parent=0, const char *name=0);
00056 virtual ~IntEdit();
00057
00058 virtual QVariant value() const;
00059 virtual void setValue(const QVariant &value, bool emitChange=true);
00060 virtual void drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value);
00061
00062 protected:
00063 virtual void setReadOnlyInternal(bool readOnly);
00064 void updateSpinWidgets();
00065
00066 protected slots:
00067 void slotValueChanged(int value);
00068
00069 private:
00070 IntSpinBox *m_edit;
00071 };
00072
00073
00074
00075 class DoubleSpinBox : public KDoubleSpinBox
00076 {
00077 Q_OBJECT
00078
00079 public:
00081 DoubleSpinBox(double lower, double upper, double step, double value=0,
00082 int precision=2, DoubleEdit *parent=0);
00083 virtual ~DoubleSpinBox() {;}
00084
00085 virtual bool eventFilter(QObject *o, QEvent *e);
00086 QLineEdit * editor () const { return KDoubleSpinBox::editor(); }
00087
00088 public slots:
00089 virtual void setValue( const QVariant& value );
00090 };
00091
00092 class KOPROPERTY_EXPORT DoubleEdit : public Widget
00093 {
00094 Q_OBJECT
00095
00096 public:
00097 DoubleEdit(Property *property, QWidget *parent=0, const char *name=0);
00098 virtual ~DoubleEdit();
00099
00100 virtual QVariant value() const;
00101 virtual void setValue(const QVariant &value, bool emitChange=true);
00102 virtual void drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value);
00103
00104 protected:
00105 virtual void setReadOnlyInternal(bool readOnly);
00106 void updateSpinWidgets();
00107
00108 protected slots:
00109 void slotValueChanged(double value);
00110
00111 private:
00112 DoubleSpinBox *m_edit;
00113 };
00114
00115 }
00116
00117 #endif
|