// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// $Header$
#include "StdMeshersGUI_DistrTable.h"
+#include <QtxDblValidator.h>
+
#include <qlayout.h>
#include <qpushbutton.h>
-#include <qvalidator.h>
#include <qlineedit.h>
//=================================================================================
{
horizontalHeader()->setLabel( 0, "t" );
horizontalHeader()->setLabel( 1, "f(t)" );
- myArgV = new QDoubleValidator( 0.0, 1.0, 3, this );
- myFuncV = new QDoubleValidator( 0.0, 1E10, 3, this );
+ myArgV = new QtxDblValidator( 0.0, 1.0, 3, this );
+ myFuncV = new QtxDblValidator( 0.0, 1E20, 3, this );
}
StdMeshersGUI_DistrTable::~StdMeshersGUI_DistrTable()
endEdit( currEditRow(), currEditCol(), accept, false );
}
+QWidget* StdMeshersGUI_DistrTable::beginEdit( int row, int col, bool replace )
+{
+ QWidget* w = QTable::beginEdit( row, col, replace );
+ if( w && w->inherits( "QLineEdit" ) )
+ ( ( QLineEdit* )w )->selectAll();
+ return w;
+}
+
void StdMeshersGUI_DistrTable::edit( const int r, const int c )
{
if( isEditing() )
{
stopEditing( false );
setNumRows( d.length()/2 );
+ QString val;
for( int i=0; i<d.length(); i++ )
- setText( i/2, i%2, QString( "%1" ).arg( d[i] ) );
+ {
+ QtxDblValidator* v = i%2==0 ? myArgV : myFuncV;
+ val = QString::number( d[i] );
+ v->fixup( val );
+ setText( i/2, i%2, val );
+ }
+}
+
+QtxDblValidator* StdMeshersGUI_DistrTable::argValidator() const
+{
+ return myArgV;
+}
+
+QtxDblValidator* StdMeshersGUI_DistrTable::funcValidator() const
+{
+ return myFuncV;
}
//=================================================================================
else if( sender()==button( REMOVE_ROW ) )
emit toEdit( REMOVE_ROW, table()->currentRow() );
}
+