From 3fa911354c62bfef09d49f47c92122e42ac14485 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 19 Jan 2011 11:21:28 +0000 Subject: [PATCH] 0020997: [CEA 420] Problem with VISU preferences Patch #7 for SALOME 5.1.3 --- src/VISUGUI/VisuGUI.cxx | 21 +++++++++++++++++---- src/VISUGUI/VisuGUI_Prs3dDlg.cxx | 4 ++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index a6483624..6221c300 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -3624,6 +3624,8 @@ extern "C" { void VisuGUI::createPreferences() { + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + // TAB: "MED import" int importTab = addPreference( tr( "MED import" ) ); //printf( "++++++++++++++++++ Tab index %d\n", importTab ); @@ -3691,10 +3693,12 @@ 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, "step", 0.1 ); - setPreferenceProperty( max, "step", 0.1 ); + 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, "precision", aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ) ); + setPreferenceProperty( max, "precision", aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ) ); + //setPreferenceProperty( min, "step", 0.1 ); + //setPreferenceProperty( max, "step", 0.1 ); // group: "Font" int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab ); @@ -4238,6 +4242,15 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH); } } + else if(b == "floating_point_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(), "precision", aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ) ); + if ( max ) + setPreferenceProperty( max->id(), "precision", aResourceMgr->integerValue( "VISU", "floating_point_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 d0cb296d..0ec61e1e 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx @@ -1485,8 +1485,8 @@ void VisuGUI_ScalarBarPane::setRange( double imin, double imax, bool sbRange ) SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_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 ); -- 2.39.2