From cda169530db5a593a28b4b40f2dc231b7c61e104 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 1 Aug 2011 11:08:00 +0000 Subject: [PATCH] Integrate patch for 0020997: [CEA 420] Problem with VISU preferences --- src/VISUGUI/VisuGUI.cxx | 29 +++++++++++++++-------------- src/VISUGUI/VisuGUI_Prs3dDlg.cxx | 4 ++-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 5b3cc7ee..65fda500 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 94c04d6c..96ab94be 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 ); -- 2.39.2