diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectCalibration.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectCalibration.h index 8dbf84f92c3b6a9e56259109fc4b379ea11d6528..f7429bac9b68dd8af65a357b6a7adbe69abcbbf3 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectCalibration.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectCalibration.h @@ -55,6 +55,8 @@ namespace CustomInterfaces void calUpdateRS(QtProperty*, double); void calSetDefaultResolution(Mantid::API::MatrixWorkspace_const_sptr ws); void resCheck(bool state); ///< handles checking/unchecking of "Create RES File" checkbox + void intensityScaleMultiplierCheck(bool state); /// Toggle the intensity scale multiplier box + void calibValidateIntensity(const QString & text); /// Check that the scale multiplier is valid private: void createRESfile(const QString& file); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h index f8889c16080364c4fd5f794a69128ec2957f5c6b..3806e24b16f97464baa99ed4730e304bd9cec1f7 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h @@ -85,9 +85,6 @@ namespace MantidQt void openDirectoryDialog(); void showMessageBox(const QString& message); /// Slot showing a message box to the user - void intensityScaleMultiplierCheck(bool state); /// Toggle the intensity scale multiplier box - void calibValidateIntensity(const QString & text); /// Check that the scale multiplier is valid - private: void loadSettings(); void readSettings(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h index d3f2285d19291d4da8312b7461e178db69111aba..2dfed573b8798cb47abd5f18e16201d93880e191 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h @@ -65,19 +65,19 @@ namespace CustomInterfaces File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ - class DLLExport IndirectDataReductionTab : public QWidget + class DLLExport IndirectDataReductionTab : public QObject { Q_OBJECT public: - IndirectDataReductionTab(Ui::IndirectDataReduction& uiForm, QWidget * parent = 0); + IndirectDataReductionTab(Ui::IndirectDataReduction& uiForm, QObject * parent = 0); virtual ~IndirectDataReductionTab(); void runTab(); void setupTab(); void validateTab(); protected slots: - /// Slot to handle when an algorithm finishs running + /// Slot to handle when an algorithm finishes running virtual void algorithmFinished(bool error); protected: @@ -100,6 +100,9 @@ namespace CustomInterfaces /// Function to run an algorithm on a seperate thread void runAlgorithm(const Mantid::API::IAlgorithm_sptr algorithm); + /// Parent QWidget (if applicable) + QWidget *m_parentWidget; + /// Plot of the input std::map<QString, QwtPlot *> m_plots; /// Curve on the plot diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectCalibration.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectCalibration.cpp index 2d2dd7be9f59c48bf17999e4d68c1660afa76bb3..e870f425741320cb39ab17d9739efaf2e4f2a42d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectCalibration.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectCalibration.cpp @@ -36,9 +36,9 @@ namespace CustomInterfaces m_propTrees["CalPropTree"]->addProperty(m_properties["CalBackMin"]); m_propTrees["CalPropTree"]->addProperty(m_properties["CalBackMax"]); - m_plots["CalPlot"] = new QwtPlot(0); - m_plots["CalPlot"]->setAxisFont(QwtPlot::xBottom, this->font()); - m_plots["CalPlot"]->setAxisFont(QwtPlot::yLeft, this->font()); + m_plots["CalPlot"] = new QwtPlot(m_parentWidget); + m_plots["CalPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); + m_plots["CalPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_uiForm.cal_plotCal->addWidget(m_plots["CalPlot"]); m_plots["CalPlot"]->setCanvasBackground(Qt::white); @@ -95,9 +95,9 @@ namespace CustomInterfaces m_propTrees["ResPropTree"]->addProperty(resRB); - m_plots["ResPlot"] = new QwtPlot(0); - m_plots["ResPlot"]->setAxisFont(QwtPlot::xBottom, this->font()); - m_plots["ResPlot"]->setAxisFont(QwtPlot::yLeft, this->font()); + m_plots["ResPlot"] = new QwtPlot(m_parentWidget); + m_plots["ResPlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); + m_plots["ResPlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_uiForm.cal_plotRes->addWidget(m_plots["ResPlot"]); m_plots["ResPlot"]->setCanvasBackground(Qt::white); @@ -514,5 +514,22 @@ namespace CustomInterfaces } } + void IndirectCalibration::intensityScaleMultiplierCheck(bool state) + { + m_uiForm.cal_leIntensityScaleMultiplier->setEnabled(state); + } + + void IndirectCalibration::calibValidateIntensity(const QString & text) + { + if(!text.isEmpty()) + { + m_uiForm.cal_valIntensityScaleMultiplier->setText(" "); + } + else + { + m_uiForm.cal_valIntensityScaleMultiplier->setText("*"); + } + } + } // namespace CustomInterfaces } // namespace Mantid diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectConvertToEnergy.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectConvertToEnergy.cpp index c8dc1f98703b7ed3c8e48596e30e8547b42cfe55..f9935f2b90b90bb3994f382a8642e047ca957615 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectConvertToEnergy.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectConvertToEnergy.cpp @@ -484,7 +484,7 @@ namespace CustomInterfaces { if(!m_backgroundDialog) { - m_backgroundDialog = new Background(this); + m_backgroundDialog = new Background(m_parentWidget); connect(m_backgroundDialog, SIGNAL(accepted()), this, SLOT(backgroundRemoval())); connect(m_backgroundDialog, SIGNAL(rejected()), this, SLOT(backgroundRemoval())); } @@ -730,7 +730,7 @@ namespace CustomInterfaces if ( m_uiForm.ind_runFiles->isValid() ) { bool ok; - QString spectraRange = QInputDialog::getText(this, "Insert Spectra Ranges", "Range: ", QLineEdit::Normal, m_uiForm.leSpectraMin->text() +"-"+ m_uiForm.leSpectraMax->text(), &ok); + QString spectraRange = QInputDialog::getText(0, "Insert Spectra Ranges", "Range: ", QLineEdit::Normal, m_uiForm.leSpectraMin->text() +"-"+ m_uiForm.leSpectraMax->text(), &ok); if ( !ok || spectraRange.isEmpty() ) { diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp index e971eefc1a94a41e0cbc31f9949fd6d9e408b49d..c2c9d23c869a2db7d7dc0de03ab6ef993f880d02 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp @@ -401,23 +401,6 @@ void IndirectDataReduction::loadSettings() settings.endGroup(); } -void IndirectDataReduction::intensityScaleMultiplierCheck(bool state) -{ - m_uiForm.cal_leIntensityScaleMultiplier->setEnabled(state); -} - -void IndirectDataReduction::calibValidateIntensity(const QString & text) -{ - if(!text.isEmpty()) - { - m_uiForm.cal_valIntensityScaleMultiplier->setText(" "); - } - else - { - m_uiForm.cal_valIntensityScaleMultiplier->setText("*"); - } -} - /** * Slot to wrap the protected showInformationBox method defined * in UserSubWindow and provide access to composed tabs. diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReductionTab.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReductionTab.cpp index 8cbbef614c0557da8f79bb4cefc43a8567407e5b..15cba3c190d320222063e5b4a56bf59ab4a2cc0d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReductionTab.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReductionTab.cpp @@ -14,20 +14,28 @@ namespace CustomInterfaces //---------------------------------------------------------------------------------------------- /** Constructor */ - IndirectDataReductionTab::IndirectDataReductionTab(Ui::IndirectDataReduction& uiForm, QWidget * parent) : QWidget(parent), + IndirectDataReductionTab::IndirectDataReductionTab(Ui::IndirectDataReduction& uiForm, QObject* parent) : QObject(parent), m_plots(), m_curves(), m_rangeSelectors(), m_properties(), m_dblManager(new QtDoublePropertyManager()), m_blnManager(new QtBoolPropertyManager()), m_grpManager(new QtGroupPropertyManager()), m_dblEdFac(new DoubleEditorFactory()), - m_algRunner(new MantidQt::API::AlgorithmRunner(this)), - m_valInt(new QIntValidator(this)), m_valDbl(new QDoubleValidator(this)), m_valPosDbl(new QDoubleValidator(this)), m_uiForm(uiForm) { - QObject::connect(m_algRunner, SIGNAL(algorithmComplete(bool)), this, SLOT(algorithmFinished(bool))); - connect(&m_pythonRunner, SIGNAL(runAsPythonScript(const QString&, bool)), this, SIGNAL(runAsPythonScript(const QString&, bool))); + m_parentWidget = dynamic_cast<QWidget *>(parent); + + if(m_parentWidget == NULL) + g_log.warning("no parent"); + + m_algRunner = new MantidQt::API::AlgorithmRunner(m_parentWidget); + m_valInt = new QIntValidator(m_parentWidget); + m_valDbl = new QDoubleValidator(m_parentWidget); + m_valPosDbl = new QDoubleValidator(m_parentWidget); const double tolerance = 0.00001; m_valPosDbl->setBottom(tolerance); + + QObject::connect(m_algRunner, SIGNAL(algorithmComplete(bool)), this, SLOT(algorithmFinished(bool))); + connect(&m_pythonRunner, SIGNAL(runAsPythonScript(const QString&, bool)), this, SIGNAL(runAsPythonScript(const QString&, bool))); } //---------------------------------------------------------------------------------------------- diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiagnostics.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiagnostics.cpp index 0c771e0d645f2769251715fc98002b41bfdafbc6..c5d3a0d505509e647560c8b148ba0b0fe5b2d79a 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiagnostics.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDiagnostics.cpp @@ -21,7 +21,7 @@ namespace CustomInterfaces IndirectDiagnostics::IndirectDiagnostics(Ui::IndirectDataReduction& uiForm, QWidget * parent) : IndirectDataReductionTab(uiForm, parent) { - m_plots["SlicePlot"] = new QwtPlot(0); + m_plots["SlicePlot"] = new QwtPlot(m_parentWidget); m_curves["SlicePlot"] = new QwtPlotCurve(); m_rangeSelectors["SliceRange1"] = new MantidWidgets::RangeSelector(m_plots["SlicePlot"]); m_rangeSelectors["SliceRange2"] = new MantidWidgets::RangeSelector(m_plots["SlicePlot"]); @@ -64,8 +64,8 @@ namespace CustomInterfaces m_propTrees["SlicePropTree"]->addProperty(m_properties["Range2"]); // Create Slice Plot Widget for Range Selection - m_plots["SlicePlot"]->setAxisFont(QwtPlot::xBottom, this->font()); - m_plots["SlicePlot"]->setAxisFont(QwtPlot::yLeft, this->font()); + m_plots["SlicePlot"]->setAxisFont(QwtPlot::xBottom, parent->font()); + m_plots["SlicePlot"]->setAxisFont(QwtPlot::yLeft, parent->font()); m_uiForm.slice_plot->addWidget(m_plots["SlicePlot"]); m_plots["SlicePlot"]->setCanvasBackground(Qt::white); // We always want one range selector... the second one can be controlled from diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMoments.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMoments.cpp index c6e464360d7e56ab14ca9fd26e8c6350683b38a9..05822ce04dd08cf65fb35c6d00dbf5819b18f5e7 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMoments.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMoments.cpp @@ -17,7 +17,7 @@ namespace CustomInterfaces { const unsigned int NUM_DECIMALS = 6; - m_plots["MomentsPlot"] = new QwtPlot(0); + m_plots["MomentsPlot"] = new QwtPlot(m_parentWidget); m_curves["MomentsPlotCurve"] = new QwtPlotCurve(); m_rangeSelectors["MomentsRangeSelector"] = new MantidWidgets::RangeSelector(m_plots["MomentsPlot"]); m_propTrees["MomentsPropTree"] = new QtTreePropertyBrowser();