From: vsr Date: Thu, 20 Jan 2011 11:34:59 +0000 (+0000) Subject: 0020997: [CEA 420] Problem with VISU preferences X-Git-Tag: V6_main_20110121 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e3d9f45b95d38960b436bcce2f886a19b089af50;p=modules%2Fvisu.git 0020997: [CEA 420] Problem with VISU preferences --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 3b23f2c8..c564c948 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -3737,6 +3737,8 @@ extern "C" { void VisuGUI::createPreferences() { + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + // TAB: General int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) ); // Quantities with individual precision settings @@ -3839,18 +3841,10 @@ void VisuGUI::createPreferences() int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab ); setPreferenceProperty( imposedGr, "columns", 4 ); - int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" ); - int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" ); - - setPreferenceProperty( min, "min", -1.e12 ); - setPreferenceProperty( min, "max", 1.e12 ); - setPreferenceProperty( min, "step", 0.1 ); - setPreferenceProperty( min, "precision", -12 ); - - setPreferenceProperty( max, "min", -1.e12 ); - setPreferenceProperty( max, "max", 1.e12 ); - setPreferenceProperty( max, "step", 0.1 ); - setPreferenceProperty( max, "precision", -12 ); + int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" ); + int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" ); + setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) ); + setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) ); // group: "Font" int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab ); @@ -4284,8 +4278,6 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" ); addPreference( "", representGr, LightApp_Preferences::Space ); - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" ); QList aMarkerTypeIndicesList; @@ -4432,6 +4424,15 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH); } } + else if(b == "visual_data_precision") { + LightApp_Preferences* pref = preferences(); + QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true ); + QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true ); + if ( min ) + setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) ); + if ( max ) + setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) ); + } if ( !aWarning.isEmpty() ){ aWarning += "The default values are applied instead."; diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx index 19782e9d..2416f563 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx @@ -1493,8 +1493,8 @@ void VisuGUI_ScalarBarPane::setRange( double imin, double imax, bool sbRange ) SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aPrecision = qAbs( aResourceMgr->integerValue("VISU", "visual_data_precision", 0) ); - MinEdit->setText(QString::number(imin, 'g', aPrecision)); - MaxEdit->setText(QString::number(imax, 'g', aPrecision)); + MinEdit->setText(QString::number(imin, 'g', aPrecision+1)); // VSR +1 is for 'g' format + MaxEdit->setText(QString::number(imax, 'g', aPrecision+1)); // VSR +1 is for 'g' format if( sbRange ) RBIrange->setChecked( true );