1 // Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: SalomeApp_IntSpinBox.h
21 // Author: Oleg UVAROV
23 #ifndef SALOMEAPP_INTSPINBOX_H
24 #define SALOMEAPP_INTSPINBOX_H
26 #include "SalomeApp.h"
28 #include <QtxIntSpinBox.h>
32 class SALOMEAPPIMPL_EXPORT SalomeApp_IntSpinBox : public QtxIntSpinBox
36 enum State { Invalid = 0, NoVariable, Incompatible, Acceptable };
37 enum SearchState { NotFound = 0, IncorrectType, Found };
40 SalomeApp_IntSpinBox( QWidget* = 0 );
41 SalomeApp_IntSpinBox( int, int, int = 1, QWidget* = 0, bool = true, bool = true );
42 virtual ~SalomeApp_IntSpinBox();
44 virtual void stepBy( int );
46 virtual int valueFromText( const QString& ) const;
47 virtual QString textFromValue( int ) const;
49 virtual QValidator::State validate( QString&, int& ) const;
51 virtual bool isValid( QString& msg, bool = false );
53 virtual void setDefaultValue( const int );
55 virtual void setValue( int );
57 virtual void setText(const QString& );
59 void setAcceptNames( const bool );
60 bool isAcceptNames() const;
62 void setShowTipOnValidate( const bool );
63 bool isShowTipOnValidate() const;
66 void textChanged( const QString& );
69 State isValid( const QString&, int& ) const;
71 int defaultValue() const;
72 bool checkRange( const int ) const;
74 SearchState findVariable( const QString&, int& ) const;
77 virtual void keyPressEvent( QKeyEvent* );
78 virtual void showEvent( QShowEvent* );
81 void onEditingFinished();
82 void onTextChanged( const QString& );
85 void connectSignalsAndSlots();
90 QString myCorrectValue;