-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <QtxComboBox.h>
#include <SALOME_InteractiveObject.hxx>
#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_IntSpinBox.h>
#include <SalomeApp_Tools.h>
#include <QApplication>
#include <QButtonGroup>
#include <QCheckBox>
+#include <QFontMetrics>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
void GridAxisTab::onMode(int isSpacing)
{
- mySpacingTreeWdg->setShown( isSpacing );
- myCoordList->setShown( !isSpacing );
- myStepSpin->setShown( !isSpacing );
- myStepLabel->setShown( !isSpacing );
+ mySpacingTreeWdg->setVisible( isSpacing );
+ myCoordList->setVisible( !isSpacing );
+ myStepSpin->setVisible( !isSpacing );
+ myStepLabel->setVisible( !isSpacing );
if ( isSpacing )
{
if ( mySpacingTreeWdg->topLevelItemCount() == 0 )
//================================================================================
/*!
- * \brief Checks grid definintion mode
+ * \brief Checks grid definition mode
*/
//================================================================================
dirs[( iOk+2 ) % 3] = dirs[ iOk ] ^ dirs[ ( iOk+1 ) % 3 ];
dirs[( iOk+1 ) % 3] = dirs[ ( iOk+2 ) % 3 ] ^ dirs[ iOk ];
}
+
+ //================================================================================
+ /*!
+ * \brief Returns a minimal width of a SpinBox depending on a precision type
+ */
+ //================================================================================
+
+ int getMinWidth( const char* precisionType )
+ {
+ int nb = SMESHGUI::resourceMgr()->integerValue( "SMESH", precisionType, -3 );
+ QString s;
+ s.fill('0', qAbs(nb)+7 );
+ QLineEdit le;
+ QFontMetrics metrics( le.font() );
+ return metrics.width( s );
+ }
}
//================================================================================
axisLbl[2] = new QLabel( tr( "AXIS_Z"), axesDirGrp );
QLabel* dLbl[3];
myAxisBtnGrp = new QButtonGroup( axesDirGrp );
- SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
+ // get spin width
+ const char * const precisionType = "len_tol_precision";
+ int minWidth = getMinWidth( precisionType );
for ( int i = 0; i < 3; ++i )
{
QPushButton* axisBtn = new QPushButton( QIcon(aPix), "", axesDirGrp );
myXDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp );
myYDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp );
myZDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp );
- myXDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" );
- myYDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" );
- myZDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" );
+ myXDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, precisionType );
+ myYDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, precisionType );
+ myZDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, precisionType );
+ myXDirSpin[i]->setMinimumWidth( minWidth );
+ myYDirSpin[i]->setMinimumWidth( minWidth );
+ myZDirSpin[i]->setMinimumWidth( minWidth );
dLbl[0] = new QLabel( tr("SMESH_DX"), axesDirGrp );
dLbl[1] = new QLabel( tr("SMESH_DY"), axesDirGrp );
dLbl[2] = new QLabel( tr("SMESH_DZ"), axesDirGrp );
//================================================================================
/*!
- * \brief Tranfer parameters from hypothesis to widgets
+ * \brief Transfer parameters from hypothesis to widgets
*/
//================================================================================
//================================================================================
/*!
- * \brief Tranfer parameters from widgets to hypothesis
+ * \brief Transfer parameters from widgets to hypothesis
*/
//================================================================================
try
{
if( isCreation() )
- SMESH::SetName( SMESH::FindSObject( h ), myName->text().toLatin1().constData() );
+ SMESH::SetName( SMESH::FindSObject( h ), myName->text().toUtf8().constData() );
// threshold
h->SetVarParameter( myThreshold->text().toLatin1().constData(), "SetSizeThreshold" );
params << myPointSpin[0]->text();
params << myPointSpin[1]->text();
params << myPointSpin[2]->text();
- h->SetVarParameter( params.join(":").toLatin1().constData(), "SetFixedPoint" );
+ h->SetVarParameter( params.join(":").toUtf8().constData(), "SetFixedPoint" );
params.clear();
SMESH::PointStruct ps;
params << spins[ax][1]->text();
params << spins[ax][2]->text();
}
- h->SetVarParameter( params.join(":").toLatin1().constData(), "SetAxesDirs" );
+ h->SetVarParameter( params.join(":").toUtf8().constData(), "SetAxesDirs" );
SMESH::DirStruct axDir[3];
for ( int ax = 0; ax < 3; ++ax )
//================================================================================
/*!
- * \brief SLOT called when the grid definintion mode changes
+ * \brief SLOT called when the grid definition mode changes
*/
//================================================================================