From 06b4d629128cb1cfd15ea71b2cec522e09c2e6c7 Mon Sep 17 00:00:00 2001 From: Elliot Oram <Elliot.Oram@stfc.ac.uk> Date: Wed, 18 May 2016 08:59:22 +0100 Subject: [PATCH] Ensure calculate binning only runs with valid input Refs #16259 --- MantidQt/CustomInterfaces/src/Indirect/Iqt.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/MantidQt/CustomInterfaces/src/Indirect/Iqt.cpp b/MantidQt/CustomInterfaces/src/Indirect/Iqt.cpp index aebeb4c5229..882fc57cb70 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/Iqt.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/Iqt.cpp @@ -205,10 +205,10 @@ bool Iqt::validate() { uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsInput); uiv.checkDataSelectorIsValid("Resolution", m_uiForm.dsResolution); - const auto eMin = m_dblManager->value(m_properties["ELow"]); - const auto eMax = m_dblManager->value(m_properties["EHigh"]); - if (eMin >= eMax) - uiv.addErrorMessage("EMin must be strictly less than EMax.\n"); + const auto eLow = m_dblManager->value(m_properties["ELow"]); + const auto eHigh = m_dblManager->value(m_properties["EHigh"]); + if (eLow >= eHigh) + uiv.addErrorMessage("ELow must be strictly less than EHigh.\n"); QString message = uiv.generateErrorMessage(); showMessageBox(message); @@ -257,9 +257,6 @@ void Iqt::updatePropertyValues(QtProperty *prop, double val) { void Iqt::calculateBinning() { using namespace Mantid::API; - disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, - SLOT(updatePropertyValues(QtProperty *, double))); - QString wsName = m_uiForm.dsInput->getCurrentDataName(); QString resName = m_uiForm.dsResolution->getCurrentDataName(); if (wsName.isEmpty() || resName.isEmpty()) @@ -268,8 +265,11 @@ void Iqt::calculateBinning() { double energyMin = m_dblManager->value(m_properties["ELow"]); double energyMax = m_dblManager->value(m_properties["EHigh"]); double numBins = m_dblManager->value(m_properties["SampleBinning"]); + if (numBins == 0) return; + if (energyMin == 0 && energyMax == 0) + return; IAlgorithm_sptr furyAlg = AlgorithmManager::Instance().create("TransformToIqt"); @@ -297,6 +297,9 @@ void Iqt::calculateBinning() { int sampleBins = propsTable->getColumn("SampleOutputBins")->cell<int>(0); int resolutionBins = propsTable->getColumn("ResolutionBins")->cell<int>(0); + disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, + SLOT(updatePropertyValues(QtProperty *, double))); + // Update data in property editor m_dblManager->setValue(m_properties["EWidth"], energyWidth); m_dblManager->setValue(m_properties["ResolutionBins"], resolutionBins); -- GitLab