Changeset View
Changeset View
Standalone View
Standalone View
src/editors/spinbox.h
Show All 16 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to | ||
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | * Boston, MA 02110-1301, USA. | 19 | * Boston, MA 02110-1301, USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef KPROPERTY_SPINBOX_H | 22 | #ifndef KPROPERTY_SPINBOX_H | ||
23 | #define KPROPERTY_SPINBOX_H | 23 | #define KPROPERTY_SPINBOX_H | ||
24 | 24 | | |||
25 | #include "KPropertyFactory.h" | 25 | #include "KPropertyWidgetsFactory.h" | ||
26 | 26 | | |||
27 | #include <QSpinBox> | 27 | #include <QSpinBox> | ||
28 | #include <QDoubleSpinBox> | 28 | #include <QDoubleSpinBox> | ||
29 | 29 | | |||
30 | //! A delegate supporting Int and UInt types | 30 | //! A delegate supporting Int and UInt types | ||
31 | /*! Note that due to KIntNumInput limitations, for UInt the maximum value | 31 | /*! Note that due to KIntNumInput limitations, for UInt the maximum value | ||
32 | is INT_MAX, not UINT_MAX. | 32 | is INT_MAX, not UINT_MAX. | ||
33 | */ | 33 | */ | ||
34 | class KPROPERTY_EXPORT KPropertyIntSpinBox : public QSpinBox | 34 | class KPROPERTYWIDGETS_EXPORT KPropertyIntSpinBox : public QSpinBox | ||
35 | { | 35 | { | ||
36 | Q_OBJECT | 36 | Q_OBJECT | ||
37 | Q_PROPERTY(QVariant value READ value WRITE setValue USER true) | 37 | Q_PROPERTY(QVariant value READ value WRITE setValue USER true) | ||
38 | 38 | | |||
39 | public: | 39 | public: | ||
40 | KPropertyIntSpinBox(const KProperty* prop, QWidget *parent, int itemHeight); | 40 | KPropertyIntSpinBox(const KProperty* prop, QWidget *parent, int itemHeight); | ||
41 | virtual ~KPropertyIntSpinBox(); | 41 | virtual ~KPropertyIntSpinBox(); | ||
42 | 42 | | |||
Show All 14 Lines | |||||
57 | protected Q_SLOTS: | 57 | protected Q_SLOTS: | ||
58 | void slotValueChanged(int value); | 58 | void slotValueChanged(int value); | ||
59 | 59 | | |||
60 | private: | 60 | private: | ||
61 | bool m_unsigned; | 61 | bool m_unsigned; | ||
62 | }; | 62 | }; | ||
63 | 63 | | |||
64 | //! Double editor | 64 | //! Double editor | ||
65 | class KPROPERTY_EXPORT KPropertyDoubleSpinBox : public QDoubleSpinBox | 65 | class KPROPERTYWIDGETS_EXPORT KPropertyDoubleSpinBox : public QDoubleSpinBox | ||
66 | { | 66 | { | ||
67 | Q_OBJECT | 67 | Q_OBJECT | ||
68 | Q_PROPERTY(double value READ value WRITE setValue USER true) | 68 | Q_PROPERTY(double value READ value WRITE setValue USER true) | ||
69 | 69 | | |||
70 | public: | 70 | public: | ||
71 | //! @todo Support setting precision limits, step, etc. | 71 | //! @todo Support setting precision limits, step, etc. | ||
72 | KPropertyDoubleSpinBox(const KProperty* prop, QWidget *parent, int itemHeight); | 72 | KPropertyDoubleSpinBox(const KProperty* prop, QWidget *parent, int itemHeight); | ||
73 | virtual ~KPropertyDoubleSpinBox(); | 73 | virtual ~KPropertyDoubleSpinBox(); | ||
Show All 18 Lines | 91 | protected: | |||
92 | //! Used to fix height of the internal spin box | 92 | //! Used to fix height of the internal spin box | ||
93 | virtual void resizeEvent( QResizeEvent * event ); | 93 | virtual void resizeEvent( QResizeEvent * event ); | ||
94 | 94 | | |||
95 | class Private; | 95 | class Private; | ||
96 | Private * const d; | 96 | Private * const d; | ||
97 | }; | 97 | }; | ||
98 | 98 | | |||
99 | //! A delegate supporting Int, UInt, LongLong and ULongLong types | 99 | //! A delegate supporting Int, UInt, LongLong and ULongLong types | ||
100 | class KPROPERTY_EXPORT KPropertyIntSpinBoxDelegate : public KPropertyEditorCreatorInterface, | 100 | class KPROPERTYWIDGETS_EXPORT KPropertyIntSpinBoxDelegate : public KPropertyEditorCreatorInterface, | ||
101 | public KPropertyValueDisplayInterface | 101 | public KPropertyValueDisplayInterface | ||
102 | { | 102 | { | ||
103 | public: | 103 | public: | ||
104 | KPropertyIntSpinBoxDelegate(); | 104 | KPropertyIntSpinBoxDelegate(); | ||
105 | 105 | | |||
106 | virtual QString displayTextForProperty( const KProperty* prop ) const; | 106 | virtual QString displayTextForProperty( const KProperty* prop ) const; | ||
107 | 107 | | |||
108 | virtual QWidget * createEditor( int type, QWidget *parent, | 108 | virtual QWidget * createEditor( int type, QWidget *parent, | ||
109 | const QStyleOptionViewItem & option, const QModelIndex & index ) const; | 109 | const QStyleOptionViewItem & option, const QModelIndex & index ) const; | ||
110 | }; | 110 | }; | ||
111 | 111 | | |||
112 | class KPROPERTY_EXPORT KPropertyDoubleSpinBoxDelegate : public KPropertyEditorCreatorInterface, | 112 | class KPROPERTYWIDGETS_EXPORT KPropertyDoubleSpinBoxDelegate : public KPropertyEditorCreatorInterface, | ||
113 | public KPropertyValueDisplayInterface | 113 | public KPropertyValueDisplayInterface | ||
114 | { | 114 | { | ||
115 | public: | 115 | public: | ||
116 | KPropertyDoubleSpinBoxDelegate(); | 116 | KPropertyDoubleSpinBoxDelegate(); | ||
117 | 117 | | |||
118 | virtual QString displayTextForProperty( const KProperty* prop ) const; | 118 | virtual QString displayTextForProperty( const KProperty* prop ) const; | ||
119 | 119 | | |||
120 | virtual QWidget * createEditor( int type, QWidget *parent, | 120 | virtual QWidget * createEditor( int type, QWidget *parent, | ||
121 | const QStyleOptionViewItem & option, const QModelIndex & index ) const; | 121 | const QStyleOptionViewItem & option, const QModelIndex & index ) const; | ||
122 | }; | 122 | }; | ||
123 | 123 | | |||
124 | #endif | 124 | #endif |