author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdeui/knuminput.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kdeui/knuminput.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/microkde/kdeui/knuminput.h b/microkde/kdeui/knuminput.h index 123fefa..9f9e200 100644 --- a/microkde/kdeui/knuminput.h +++ b/microkde/kdeui/knuminput.h | |||
@@ -16,32 +16,37 @@ | |||
16 | * This library is distributed in the hope that it will be useful, | 16 | * This library is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | * Library General Public License for more details. | 19 | * Library General Public License for more details. |
20 | * | 20 | * |
21 | * You should have received a copy of the GNU Library General Public License | 21 | * You should have received a copy of the GNU Library General Public License |
22 | * along with this library; see the file COPYING.LIB. If not, write to | 22 | * along with this library; see the file COPYING.LIB. If not, write to |
23 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 23 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
24 | * Boston, MA 02111-1307, USA. | 24 | * Boston, MA 02111-1307, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef K_NUMINPUT_H | 27 | #ifndef K_NUMINPUT_H |
28 | #define K_NUMINPUT_H | 28 | #define K_NUMINPUT_H |
29 | 29 | ||
30 | #include <qwidget.h> | 30 | #include <qwidget.h> |
31 | #include <qspinbox.h> | 31 | #include <qspinbox.h> |
32 | #include <QLineEdit> | ||
33 | //Added by qt3to4: | ||
34 | #include <QResizeEvent> | ||
35 | #include <QLabel> | ||
36 | #include <QEvent> | ||
32 | 37 | ||
33 | class QLabel; | 38 | class QLabel; |
34 | class QSlider; | 39 | class QSlider; |
35 | class QLineEdit; | 40 | class QLineEdit; |
36 | class QLayout; | 41 | class QLayout; |
37 | class QValidator; | 42 | class QValidator; |
38 | 43 | ||
39 | class KIntSpinBox; | 44 | class KIntSpinBox; |
40 | 45 | ||
41 | /* ------------------------------------------------------------------------ */ | 46 | /* ------------------------------------------------------------------------ */ |
42 | 47 | ||
43 | /** | 48 | /** |
44 | * You need to inherit from this class if you want to implement K*NumInput | 49 | * You need to inherit from this class if you want to implement K*NumInput |
45 | * for a different variable type | 50 | * for a different variable type |
46 | * | 51 | * |
47 | */ | 52 | */ |
@@ -68,33 +73,33 @@ public: | |||
68 | * | 73 | * |
69 | * @param label The text of the label. | 74 | * @param label The text of the label. |
70 | * Use QString::null to remove an existing one. | 75 | * Use QString::null to remove an existing one. |
71 | * | 76 | * |
72 | * @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and | 77 | * @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and |
73 | * @p AlignTop, @p AlignVCenter, @p AlignBottom. | 78 | * @p AlignTop, @p AlignVCenter, @p AlignBottom. |
74 | * default is @p AlignLeft | @p AlignTop. | 79 | * default is @p AlignLeft | @p AlignTop. |
75 | * | 80 | * |
76 | * The vertical alignment flags have special meaning with this | 81 | * The vertical alignment flags have special meaning with this |
77 | * widget: | 82 | * widget: |
78 | * | 83 | * |
79 | * @li @p AlignTop The label is placed above the edit/slider | 84 | * @li @p AlignTop The label is placed above the edit/slider |
80 | * @li @p AlignVCenter The label is placed left beside the edit | 85 | * @li @p AlignVCenter The label is placed left beside the edit |
81 | * @li @p AlignBottom The label is placed below the edit/slider | 86 | * @li @p AlignBottom The label is placed below the edit/slider |
82 | * | 87 | * |
83 | */ | 88 | */ |
84 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | 89 | virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); |
85 | 90 | ||
86 | /** | 91 | /** |
87 | * @return the text of the label. | 92 | * @return the text of the label. |
88 | */ | 93 | */ |
89 | QString label() const; | 94 | QString label() const; |
90 | 95 | ||
91 | /** | 96 | /** |
92 | * @return if the num input has a slider. | 97 | * @return if the num input has a slider. |
93 | * @since 3.1 | 98 | * @since 3.1 |
94 | */ | 99 | */ |
95 | bool showSlider() const { return m_slider; } | 100 | bool showSlider() const { return m_slider; } |
96 | 101 | ||
97 | /** | 102 | /** |
98 | * Sets the spacing of tickmarks for the slider. | 103 | * Sets the spacing of tickmarks for the slider. |
99 | * | 104 | * |
100 | * @param minor Minor tickmark separation. | 105 | * @param minor Minor tickmark separation. |
@@ -289,33 +294,33 @@ public: | |||
289 | /** | 294 | /** |
290 | * @return the maximum value. | 295 | * @return the maximum value. |
291 | */ | 296 | */ |
292 | int maxValue() const; | 297 | int maxValue() const; |
293 | 298 | ||
294 | /** | 299 | /** |
295 | * Sets the special value text. If set, the SpinBox will display | 300 | * Sets the special value text. If set, the SpinBox will display |
296 | * this text instead of the numeric value whenever the current | 301 | * this text instead of the numeric value whenever the current |
297 | * value is equal to minVal(). Typically this is used for indicating | 302 | * value is equal to minVal(). Typically this is used for indicating |
298 | * that the choice has a special (default) meaning. | 303 | * that the choice has a special (default) meaning. |
299 | */ | 304 | */ |
300 | void setSpecialValueText(const QString& text); | 305 | void setSpecialValueText(const QString& text); |
301 | 306 | ||
302 | /** | 307 | /** |
303 | * @reimplemented | 308 | * @reimplemented |
304 | */ | 309 | */ |
305 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | 310 | virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); |
306 | 311 | ||
307 | /** | 312 | /** |
308 | * This method returns the minimum size necessary to display the | 313 | * This method returns the minimum size necessary to display the |
309 | * control. The minimum size is enough to show all the labels | 314 | * control. The minimum size is enough to show all the labels |
310 | * in the current font (font change may invalidate the return value). | 315 | * in the current font (font change may invalidate the return value). |
311 | * | 316 | * |
312 | * @return the minimum size necessary to show the control | 317 | * @return the minimum size necessary to show the control |
313 | */ | 318 | */ |
314 | virtual QSize minimumSizeHint() const; | 319 | virtual QSize minimumSizeHint() const; |
315 | 320 | ||
316 | public slots: | 321 | public slots: |
317 | /** | 322 | /** |
318 | * Sets the value of the control. | 323 | * Sets the value of the control. |
319 | */ | 324 | */ |
320 | void setValue(int); | 325 | void setValue(int); |
321 | 326 | ||
@@ -575,33 +580,33 @@ public: | |||
575 | * @return the current value in units of @ref #referencePoint. | 580 | * @return the current value in units of @ref #referencePoint. |
576 | * @since 3.1 | 581 | * @since 3.1 |
577 | */ | 582 | */ |
578 | double relativeValue() const; | 583 | double relativeValue() const; |
579 | 584 | ||
580 | /** | 585 | /** |
581 | * Sets the special value text. If set, the spin box will display | 586 | * Sets the special value text. If set, the spin box will display |
582 | * this text instead of the numeric value whenever the current | 587 | * this text instead of the numeric value whenever the current |
583 | * value is equal to @ref #minVal(). Typically this is used for indicating | 588 | * value is equal to @ref #minVal(). Typically this is used for indicating |
584 | * that the choice has a special (default) meaning. | 589 | * that the choice has a special (default) meaning. |
585 | */ | 590 | */ |
586 | void setSpecialValueText(const QString& text); | 591 | void setSpecialValueText(const QString& text); |
587 | 592 | ||
588 | /** | 593 | /** |
589 | * @reimplemented | 594 | * @reimplemented |
590 | */ | 595 | */ |
591 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | 596 | virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); |
592 | /** | 597 | /** |
593 | * @reimplemented | 598 | * @reimplemented |
594 | */ | 599 | */ |
595 | virtual QSize minimumSizeHint() const; | 600 | virtual QSize minimumSizeHint() const; |
596 | /** | 601 | /** |
597 | * @reimplemented | 602 | * @reimplemented |
598 | */ | 603 | */ |
599 | virtual bool eventFilter(QObject*, QEvent*); | 604 | virtual bool eventFilter(QObject*, QEvent*); |
600 | 605 | ||
601 | public slots: | 606 | public slots: |
602 | /** | 607 | /** |
603 | * Sets the value of the control. | 608 | * Sets the value of the control. |
604 | */ | 609 | */ |
605 | void setValue(double); | 610 | void setValue(double); |
606 | 611 | ||
607 | /** | 612 | /** |
@@ -745,32 +750,36 @@ public: | |||
745 | virtual ~KIntSpinBox(); | 750 | virtual ~KIntSpinBox(); |
746 | 751 | ||
747 | /** | 752 | /** |
748 | * Sets the base in which the numbers in the spin box are represented. | 753 | * Sets the base in which the numbers in the spin box are represented. |
749 | */ | 754 | */ |
750 | void setBase(int base); | 755 | void setBase(int base); |
751 | /** | 756 | /** |
752 | * @return the base in which numbers in the spin box are represented. | 757 | * @return the base in which numbers in the spin box are represented. |
753 | */ | 758 | */ |
754 | int base() const; | 759 | int base() const; |
755 | /** | 760 | /** |
756 | * sets focus and optionally marks all text | 761 | * sets focus and optionally marks all text |
757 | * | 762 | * |
758 | */ | 763 | */ |
759 | void setEditFocus(bool mark); | 764 | void setEditFocus(bool mark); |
760 | 765 | ||
766 | void setValidator(const QValidator *v) { | ||
767 | lineEdit()->setValidator(v); | ||
768 | } | ||
769 | |||
761 | protected: | 770 | protected: |
762 | 771 | ||
763 | /** | 772 | /** |
764 | * Overloaded the method in QSpinBox | 773 | * Overloaded the method in QSpinBox |
765 | * to make use of the base given in the constructor. | 774 | * to make use of the base given in the constructor. |
766 | */ | 775 | */ |
767 | virtual QString mapValueToText(int); | 776 | virtual QString mapValueToText(int); |
768 | 777 | ||
769 | /** | 778 | /** |
770 | * Overloaded the method in QSpinBox | 779 | * Overloaded the method in QSpinBox |
771 | * to make use of the base given in the constructor. | 780 | * to make use of the base given in the constructor. |
772 | */ | 781 | */ |
773 | virtual int mapTextToValue(bool*); | 782 | virtual int mapTextToValue(bool*); |
774 | 783 | ||
775 | private: | 784 | private: |
776 | int val_base; | 785 | int val_base; |