From 62e110f8e67bd40050e6dc20f2b4fab6a8f6f36a Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 22 Sep 2005 06:31:51 +0000 Subject: [PATCH] To introduce naming of field components --- src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 31 +++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 62a3a4b6..a145b62a 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -75,10 +75,6 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref): myModeLbl = new QLabel("Scalar Mode", RangeGroup); myModeCombo = new QComboBox(RangeGroup); - myModeCombo->insertItem("Modulus"); - myModeCombo->insertItem("Component 1"); - myModeCombo->insertItem("Component 2"); - myModeCombo->insertItem("Component 3"); CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup); CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); @@ -529,18 +525,25 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { bool isScalarMode = (aNbComp > 1); // // update myModeCombo - VISU::TNames& aNamesOfComponents =thePrs->GetField()->myCompNames; - VISU::TNames& aUnitNamesOfComponents=thePrs->GetField()->myUnitNames; myModeCombo->clear(); myModeCombo->insertItem(""); - for (int i=1; i<=aNbComp; ++i) { - VISU::TName aNmUn=aNamesOfComponents[i-1]; - VISU::TName& aUnits=aUnitNamesOfComponents[i-1]; - if (!aUnits.empty()) { - aNmUn+=", "; - aNmUn+=aUnits; - } - myModeCombo->insertItem(aNmUn); + const VISU::PField& aField = thePrs->GetField(); + const VISU::TNames& aCompNames = aField->myCompNames; + const VISU::TNames& aUnitNames = aField->myUnitNames; + for(int i = 0; i < aNbComp; i++){ + QString aComponent = QString(aCompNames[i]).simplifyWhiteSpace(); + if(aComponent.isNull() || aComponent == "") + aComponent = "Component " + QString::number(i+1); + else + aComponent = "[" + QString::number(i+1) + "] " + aComponent; + + QString anUnit = QString(aUnitNames[i]).simplifyWhiteSpace(); + if(anUnit.isNull() || anUnit == "") + anUnit = "-"; + + aComponent = aComponent + ", " + anUnit; + + myModeCombo->insertItem(aComponent); } // myModeCombo->setCurrentItem(thePrs->GetScalarMode()); -- 2.39.2