-// Copyright (C) 2016 CEA/DEN, EDF R&D
+// Copyright (C) 2016-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#ifdef WIN32
+#define NOMINMAX
+#endif
+
#include "WidgetPresentationParameters.hxx"
#include <Basics_Utils.hxx>
this, SLOT(onComboColorMapIndexChanged(int)) );
QObject::connect(_ui.comboBoxSliceOrient, SIGNAL(activated(int)),
this, SLOT(onComboOrientIndexChanged(int)) );
- QObject::connect(_ui.spinBox, SIGNAL(valueChanged(int)),
- this, SLOT(onSpinBoxValueChanged(int)) );
+ QObject::connect(_ui.spinBox, SIGNAL(editingFinished()),
+ this, SLOT(onSpinBoxEditingFinished()) );
}
void
}
void
-WidgetPresentationParameters::onSpinBoxValueChanged(int val)
+WidgetPresentationParameters::onSpinBoxEditingFinished()
{
- if (!_blockSig) emit spinBoxValueChanged(val);
+ if (!_blockSig) emit spinBoxValueChanged(_ui.spinBox->value());
}
void
else
{
_ui.widgetDynamic->show();
- // It is the WidgetHelper responsability to re-show the widgets it needs
+ // It is the WidgetHelper responsibility to re-show the widgets it needs
_ui.labelCompo->hide();
_ui.comboBoxCompo->hide();
_ui.labelMeshMode->hide();
string
WidgetPresentationParameters::getComponent() const
{
- if (_ui.comboBoxCompo->currentIndex() == 0) // Euclidean norm
+ if (_ui.comboBoxCompo->count() > 1 && _ui.comboBoxCompo->count() <= 3)
+ if (_ui.comboBoxCompo->currentIndex() == 0) // Euclidean norm
return "";
return _ui.comboBoxCompo->currentText().toStdString();
_ui.comboBoxCompo->show();
_ui.comboBoxCompo->clear();
- _ui.comboBoxCompo->addItem(tr("LAB_EUCLIDEAN_NORM"));
+ bool vectorField = (compos.size() > 1 && compos.size() <= 3);
+ if (vectorField)
+ _ui.comboBoxCompo->addItem(tr("LAB_EUCLIDEAN_NORM"));
for(vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
_ui.comboBoxCompo->addItem(QString::fromStdString(*it));
- _ui.comboBoxCompo->setCurrentIndex(selecIndex);
+ if (!vectorField)
+ _ui.comboBoxCompo->setCurrentIndex(std::max(0, selecIndex-1));
+ else
+ _ui.comboBoxCompo->setCurrentIndex(selecIndex);
_blockSig = false;
}
}
// Show the widget:
- _ui.labelSpinBox->setText(tr("LAB_NB_CONTOURS"));
+ _ui.labelSpinBox->setText(tr("LAB_NB_CONTOURS").arg(MEDCALC::NB_CONTOURS_MAX));
+
_ui.labelSpinBox->show();
_ui.spinBox->show();
+ _ui.spinBox->setRange(1, MEDCALC::NB_CONTOURS_MAX);
_ui.spinBox->setValue(nbContour);
_blockSig = false;
}
// Show the widget:
- _ui.labelSpinBox->setText(tr("LAB_NB_SLICES"));
+ _ui.labelSpinBox->setText(tr("LAB_NB_SLICES").arg(MEDCALC::NB_SLICES_MAX));
_ui.labelSpinBox->show();
_ui.spinBox->show();
+ _ui.spinBox->setRange(1, MEDCALC::NB_SLICES_MAX);
_ui.spinBox->setValue(nbSlices);
_blockSig = false;