diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 47d455dd55be855e4cc691c32f687f723d9247ee (patch) | |
tree | 52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmlineedits.h | |
download | tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpovmodeler/pmlineedits.h')
-rw-r--r-- | kpovmodeler/pmlineedits.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/kpovmodeler/pmlineedits.h b/kpovmodeler/pmlineedits.h new file mode 100644 index 00000000..9a12c384 --- /dev/null +++ b/kpovmodeler/pmlineedits.h @@ -0,0 +1,133 @@ +//-*-C++-*- +/* +************************************************************************** + description + -------------------- + copyright : (C) 2000-2001 by Andreas Zehender + email : [email protected] +************************************************************************** + +************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +**************************************************************************/ + +#ifndef PM_LINEEDITS_H +#define PM_LINEEDITS_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qlineedit.h> + +/** + * Lineedit for float input + */ + +class PMFloatEdit : public QLineEdit +{ + Q_OBJECT +public: + enum ValidationOp { OpGreater, OpGreaterEqual, + OpLess, OpLessEqual }; + /** + * Simple constructor + */ + PMFloatEdit( QWidget* parent, const char* name = 0 ); + /** + * Sets the validation for the lineedit. + * + * If checkLower is true, the value has to be >= the lowerValue. + * + * If checkUpper is true, the value has to be <= the upperValue. + * + * By default no range check is made. + */ + void setValidation( bool checkLower, double lowerValue, + bool checkUpper, double upperValue ); + /** + * Sets the validation operators for the lower and upper value. + * + * Valid values for lower are OpGreater and OpGreaterEqual, + * valid values for upper are OpLess and OpLessEqual. + */ + void setValidationOperator( ValidationOp lower, ValidationOp upper ); + /** + * Returns true, if the text is a valid float in the valid range + */ + bool isDataValid( ); + /** + * Returns the float value + */ + double value( ) const; + /** + * Sets the value + */ + void setValue( double d, int precision = 5 ); +signals: + /** + * emitted if the text is changed + */ + void dataChanged( ); +public slots: + void slotEditTextChanged( const QString& t ); +private: + bool m_bCheckLower, m_bCheckUpper; + double m_lowerValue, m_upperValue; + ValidationOp m_lowerOp, m_upperOp; +}; + + +/** + * Lineedit for int input + */ + +class PMIntEdit : public QLineEdit +{ + Q_OBJECT +public: + /** + * Simple constructor + */ + PMIntEdit( QWidget* parent, const char* name = 0 ); + /** + * Sets the validation for the lineedit. + * + * If checkLower is true, the value has to be >= the lowerValue. + * + * If checkUpper is true, the value has to be <= the upperValue. + * + * By default no range check is made. + */ + void setValidation( bool checkLower, int lowerValue, + bool checkUpper, int upperValue ); + /** + * Returns true, if the text is a valid integer in the valid range + */ + bool isDataValid( ); + /** + * Returns the integer value + */ + int value( ) const; + /** + * Sets the value + */ + void setValue( int i ); +signals: + /** + * emitted if the text is changed + */ + void dataChanged( ); +public slots: + void slotEditTextChanged( const QString& t ); +private: + bool m_bCheckLower, m_bCheckUpper; + int m_lowerValue, m_upperValue; +}; + +#endif |