Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SALOMEAPP_INTSPINBOX_H
00024 #define SALOMEAPP_INTSPINBOX_H
00025
00026 #include "SalomeApp.h"
00027
00028 #include <QtxIntSpinBox.h>
00029
00030 #include <QValidator>
00031
00032 class SALOMEAPP_EXPORT SalomeApp_IntSpinBox : public QtxIntSpinBox
00033 {
00034 Q_OBJECT
00035
00036 enum State { Invalid = 0, NoVariable, Incompatible, Acceptable };
00037 enum SearchState { NotFound = 0, IncorrectType, Found };
00038
00039 public:
00040 SalomeApp_IntSpinBox( QWidget* = 0 );
00041 SalomeApp_IntSpinBox( int, int, int = 1, QWidget* = 0, bool = true, bool = true );
00042 virtual ~SalomeApp_IntSpinBox();
00043
00044 virtual void stepBy( int );
00045
00046 virtual int valueFromText( const QString& ) const;
00047 virtual QString textFromValue( int ) const;
00048
00049 virtual QValidator::State validate( QString&, int& ) const;
00050
00051 virtual bool isValid( QString& msg, bool = false );
00052
00053 virtual void setDefaultValue( const int );
00054
00055 virtual void setValue( int );
00056
00057 virtual void setText(const QString& );
00058
00059 void setAcceptNames( const bool );
00060 bool isAcceptNames() const;
00061
00062 void setShowTipOnValidate( const bool );
00063 bool isShowTipOnValidate() const;
00064
00065 signals:
00066 void textChanged( const QString& );
00067
00068 protected:
00069 State isValid( const QString&, int& ) const;
00070
00071 int defaultValue() const;
00072 bool checkRange( const int ) const;
00073
00074 SearchState findVariable( const QString&, int& ) const;
00075
00076 protected:
00077 virtual void keyPressEvent( QKeyEvent* );
00078 virtual void showEvent( QShowEvent* );
00079
00080 protected slots:
00081 void onEditingFinished();
00082 void onTextChanged( const QString& );
00083
00084 private:
00085 void connectSignalsAndSlots();
00086
00087 private:
00088 int myDefaultValue;
00089
00090 QString myCorrectValue;
00091 QString myTextValue;
00092
00093 bool myAcceptNames;
00094 bool myShowTip;
00095 };
00096
00097 #endif