X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshersGUI%2FStdMeshersGUI_CartesianParamCreator.cxx;h=21f64ed4fd07b89dbc368316c4a339016a9a3a3b;hp=be926470e72f1ced2c0ddb7be1712319441d0514;hb=971a1433b37f071c05729600d2d64bbb44616734;hpb=cd3ffac3fabc68b4d1dee2ad199302f04b20d2c8 diff --git a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx index be926470e..21f64ed4f 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -58,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -319,10 +319,10 @@ namespace StdMeshersGUI 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 ) @@ -677,6 +677,22 @@ namespace 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 ); + } } //================================================================================ @@ -858,7 +874,9 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame() 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 ); @@ -867,9 +885,12 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame() 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 ); @@ -916,7 +937,7 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame() } // Show axes - myAxesLen = 1; + myAxesLen = 120; // default trihedron size is 100 myOrigin[0] = myOrigin[1] = myOrigin[2] = 0.; TopoDS_Shape shape; QString shapeEntry = getMainShapeEntry();