• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

knuminput.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002  *  Copyright (c) 1997 Patrick Dowler <dowler@morgul.fsh.uvic.ca>
00003  *  Copyright (c) 2000 Dirk Mueller <mueller@kde.org>
00004  *  Copyright (c) 2002 Marc Mutz <mutz@kde.org>
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Library General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Library General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Library General Public License
00017  *  along with this library; see the file COPYING.LIB.  If not, write to
00018  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  *  Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef K_NUMINPUT_H
00023 #define K_NUMINPUT_H
00024 
00025 #include <kdeui_export.h>
00026 
00027 #include <QtGui/QWidget>
00028 #include <QtGui/QSpinBox>
00029 
00030 class QSlider;
00031 class QSpinBox;
00032 class QValidator;
00033 
00034 class KIntSpinBox;
00035 class KNumInputPrivate;
00036 
00042 class KDEUI_EXPORT KNumInput : public QWidget
00043 {
00044     Q_OBJECT
00045     Q_PROPERTY( QString label READ label WRITE setLabel )
00046 public:
00053     explicit KNumInput(QWidget* parent=0);
00054 
00060     KDE_CONSTRUCTOR_DEPRECATED KNumInput(QWidget *parent, KNumInput* below);
00061     
00065     ~KNumInput();
00066 
00084     virtual void setLabel(const QString & label, Qt::Alignment a = Qt::AlignLeft | Qt::AlignTop);
00085 
00089     QString label() const;
00090 
00094     bool showSlider() const;
00095 
00102     void setSteps(int minor, int major);
00103 
00109     virtual QSize sizeHint() const;
00110 
00111 protected:
00116     QSlider *slider() const;
00117       
00123     void layout(bool deep);
00124 
00133     virtual void doLayout() = 0;
00134 
00135 private:
00136     friend class KNumInputPrivate;
00137     KNumInputPrivate * const d;
00138     
00139     Q_DISABLE_COPY(KNumInput)
00140 };
00141 
00142 /* ------------------------------------------------------------------------ */
00143 
00169 class KDEUI_EXPORT KIntNumInput : public KNumInput
00170 {
00171     Q_OBJECT
00172     Q_PROPERTY( int value READ value WRITE setValue USER true )
00173     Q_PROPERTY( int minimum READ minimum WRITE setMinimum )
00174     Q_PROPERTY( int maximum READ maximum WRITE setMaximum )
00175     Q_PROPERTY( int referencePoint READ referencePoint WRITE setReferencePoint )
00176     Q_PROPERTY( double relativeValue READ relativeValue WRITE setRelativeValue )
00177     Q_PROPERTY( QString suffix READ suffix WRITE setSuffix )
00178     Q_PROPERTY( QString prefix READ prefix WRITE setPrefix )
00179     Q_PROPERTY( QString specialValueText READ specialValueText WRITE setSpecialValueText )
00180 
00181 public:
00186     explicit KIntNumInput(QWidget *parent=0);
00198     explicit KIntNumInput(int value, QWidget *parent=0,int base = 10);
00199 
00218     KDE_CONSTRUCTOR_DEPRECATED KIntNumInput(KNumInput* below, int value, QWidget *parent, int base = 10);
00219 
00225     virtual ~KIntNumInput();
00226 
00230     int value() const;
00231 
00235     double relativeValue() const;
00236 
00240     int referencePoint() const;
00241 
00246     QString suffix() const;
00251     QString prefix() const;
00256     QString specialValueText() const;
00257 
00266     void setRange(int min, int max, int step=1);
00267 
00271     KDE_DEPRECATED void setRange(int min, int max, int step, bool slider);
00272 
00277     void setSliderEnabled(bool enabled=true);
00278 
00282     void setMinimum(int min);
00286     int minimum() const;
00290     void setMaximum(int max);
00294     int maximum() const;
00295 
00302     void setSpecialValueText(const QString& text);
00303 
00304     virtual void setLabel(const QString & label, Qt::Alignment a = Qt::AlignLeft | Qt::AlignTop);
00305 
00313     virtual QSize minimumSizeHint() const;
00314     
00315 public Q_SLOTS:
00319     void setValue(int);
00320 
00324     void setRelativeValue(double);
00325 
00329     void setReferencePoint(int);
00330 
00340     void setSuffix(const QString &suffix);
00341 
00349     void setPrefix(const QString &prefix);
00350 
00355     void setEditFocus( bool mark = true );
00356 
00357 Q_SIGNALS:
00362     void valueChanged(int);
00363 
00368     void relativeValueChanged(double);
00369 
00370 private Q_SLOTS:
00371     void spinValueChanged(int);
00372     void slotEmitRelativeValueChanged(int);
00373 
00374 protected:
00379     QSpinBox *spinBox() const;
00380       
00381     virtual void doLayout();
00382     void resizeEvent ( QResizeEvent * );
00383 
00384 private:
00385     void init(int value, int _base);
00386 
00387 private:
00388     class KIntNumInputPrivate;
00389     friend class KIntNumInputPrivate;
00390     KIntNumInputPrivate * const d;
00391     
00392     Q_DISABLE_COPY(KIntNumInput)
00393 };
00394 
00395 
00396 /* ------------------------------------------------------------------------ */
00397 
00398 class KDoubleLine;
00399 
00427 class KDEUI_EXPORT KDoubleNumInput : public KNumInput
00428 {
00429     Q_OBJECT
00430     Q_PROPERTY( double value READ value WRITE setValue USER true )
00431     Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
00432     Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
00433     Q_PROPERTY( QString suffix READ suffix WRITE setSuffix )
00434     Q_PROPERTY( QString prefix READ prefix WRITE setPrefix )
00435     Q_PROPERTY( QString specialValueText READ specialValueText WRITE setSpecialValueText )
00436     Q_PROPERTY( int decimals READ decimals WRITE setDecimals )
00437     Q_PROPERTY( double referencePoint READ referencePoint WRITE setReferencePoint )
00438     Q_PROPERTY( double relativeValue READ relativeValue  WRITE setRelativeValue )
00439 
00440 public:
00445     explicit KDoubleNumInput(QWidget *parent = 0);
00446 
00457     KDoubleNumInput(double lower, double upper, double value, QWidget *parent=0,double step=0.01,
00458             int precision=2);
00459 
00463     virtual ~KDoubleNumInput();
00464 
00465 
00487     KDE_CONSTRUCTOR_DEPRECATED KDoubleNumInput(KNumInput* below,
00488             double lower, double upper, double value, QWidget *parent=0,double step=0.02,
00489             int precision=2);
00490 
00494     double value() const;
00495 
00500     QString suffix() const;
00501 
00506     QString prefix() const;
00507 
00512     int decimals() const;
00513 
00518     QString specialValueText() const;
00519 
00526     void setRange(double min, double max, double step=1, bool slider=true);
00530     void setMinimum(double min);
00534     double minimum() const;
00538     void setMaximum(double max);
00542     double maximum() const;
00543 
00547     void setDecimals(int decimals);
00548 
00549     KDE_DEPRECATED void setPrecision(int precision) { setDecimals(precision); }
00550 
00554     double referencePoint() const;
00555 
00559     double relativeValue() const;
00560 
00567     void setSpecialValueText(const QString& text);
00568 
00569     virtual void setLabel(const QString & label, Qt::Alignment a = Qt::AlignLeft | Qt::AlignTop);
00570     virtual QSize minimumSizeHint() const;
00571 
00572 public Q_SLOTS:
00576     void setValue(double);
00577 
00581     void setRelativeValue(double);
00582 
00588     void setReferencePoint(double ref);
00589 
00597     void setSuffix(const QString &suffix);
00598 
00605     void setPrefix(const QString &prefix);
00606 
00607 Q_SIGNALS:
00612     void valueChanged(double);
00619     void relativeValueChanged(double);
00620 
00621 private Q_SLOTS:
00622     void sliderMoved(int);
00623     void spinBoxChanged(double);
00624     void slotEmitRelativeValueChanged(double);
00625 
00626 protected:
00627     virtual void doLayout();
00628     void resizeEvent ( QResizeEvent * );
00629 
00630     friend class KDoubleLine;
00631 private:
00632     void init(double value, double lower, double upper,
00633     double step, int precision);
00634     double mapSliderToSpin(int) const;
00635     void updateLegacyMembers();
00636 
00637 private:
00638     class KDoubleNumInputPrivate;
00639     friend class KDoubleNumInputPrivate;
00640     KDoubleNumInputPrivate * const d;
00641 
00642     Q_DISABLE_COPY(KDoubleNumInput)
00643 };
00644 
00645 
00646 /* ------------------------------------------------------------------------ */
00647 
00657 class KDEUI_EXPORT KIntSpinBox : public QSpinBox
00658 {
00659     Q_OBJECT
00660     Q_PROPERTY( int base READ base WRITE setBase )
00661 
00662 public:
00663 
00671     explicit KIntSpinBox( QWidget *parent = 0 );
00672 
00686     KIntSpinBox(int lower, int upper, int step, int value, QWidget *parent,int base = 10);
00687 
00691     virtual ~KIntSpinBox();
00692 
00696     void setBase(int base);
00700     int base() const;
00705     void setEditFocus(bool mark);
00706 
00707 protected:
00708 
00713     virtual QString textFromValue(int) const;
00714 
00719     virtual int valueFromText(const QString &text) const;
00720 
00721 private:
00722     class KIntSpinBoxPrivate;
00723     friend class KIntSpinBoxPrivate;
00724     KIntSpinBoxPrivate *const d;
00725     
00726     Q_DISABLE_COPY(KIntSpinBox)
00727 };
00728 
00729 #endif // K_NUMINPUT_H

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal