diff --git a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp index c48a7dc0ff69c2eed551900203230cb71b66f971..bd8c205df2115263cc59e6c3efa53e8789fd9e1b 100644 --- a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp +++ b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp @@ -7815,7 +7815,8 @@ void ApplicationWindow::selectMultiPeak(bool showFitPropertyBrowser) //Called when setting up usual peakPickerTool PeakPickerTool* ppicker = new PeakPickerTool(g, mantidUI->fitFunctionBrowser(), mantidUI, showFitPropertyBrowser); g->setActiveTool(ppicker); - connect(plot,SIGNAL(windowStateChanged(Qt::WindowStates, Qt::WindowStates)),ppicker,SLOT(windowStateChanged(Qt::WindowStates, Qt::WindowStates))); + // do we need this? PeakPickerTool::windowStateChanged does nothing + //connect(plot,SIGNAL(windowStateChanged(Qt::WindowStates, Qt::WindowStates)),ppicker,SLOT(windowStateChanged(Qt::WindowStates, Qt::WindowStates))); } } diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h index 18dfa8672d5df61e5021b3192dca305e8a65562b..dd118af11fa06ce1082dd0f5e84b248172417189 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/FitPropertyBrowser.h @@ -171,8 +171,6 @@ public: /// Creates the "Constraints" property value for the Fit algorithm QString getConstraintsString()const; - void init(); - // send parameterChanged signal void sendParameterChanged(const Mantid::API::IFitFunction* f){emit parameterChanged(f);} @@ -303,7 +301,15 @@ private slots: void executeCustomSetupLoad(const QString& name); void executeCustomSetupRemove(const QString& name); + +protected: + /// actions to do before the browser made visible + virtual void showEvent(QShowEvent* e); + /// actions to do before the browser is hidden + virtual void hideEvent(QHideEvent* e); + private: + /// load and save function void loadFunction(const QString& funcString); void saveFunction(const QString& fnName); diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp index 6560529c73c265fc9b71248b9ec33fe6a3ab63cc..7beb5691b16c1a966a88d8dbe4b72d2be61168c8 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp @@ -399,21 +399,14 @@ m_mantidui(mantidui) m_changeSlotsEnabled = true; - // Observe what workspaces are added and deleted unless it's a custom fitting, all workspaces for custom fitting (eg muon analysis) - // should be manually added. - if (!m_customFittings) - { - observeAdd(); - } - observePostDelete(); - - init(); + populateFunctionNames(); // Should only be done for the fitBrowser which is part of MantidPlot if (!m_customFittings) { if (m_mantidui->metaObject()->indexOfMethod("executeAlgorithm(QString,QMap<QString,QString>,Mantid::API::AlgorithmObserver*)") >= 0) { + // this make the progress bar work with Fit algorithm running form the fit browser connect(this,SIGNAL(executeFit(QString,QMap<QString,QString>,Mantid::API::AlgorithmObserver*)), m_mantidui,SLOT(executeAlgorithm(QString,QMap<QString,QString>,Mantid::API::AlgorithmObserver*))); } @@ -913,6 +906,12 @@ std::string FitPropertyBrowser::workspaceName()const void FitPropertyBrowser::setWorkspaceName(const QString& wsName) { int i = m_workspaceNames.indexOf(wsName); + if (i < 0) + { + // workspace may not be found because add notification hasn't been processed yet + populateWorkspaceNames(); + i = m_workspaceNames.indexOf(wsName); + } if (i >= 0) { m_enumManager->setValue(m_workspace,i); @@ -1512,12 +1511,32 @@ void FitPropertyBrowser::populateWorkspaceNames() m_enumManager->setEnumNames(m_workspace, m_workspaceNames); } -void FitPropertyBrowser::init() +/** + * Connect to the AnalysisDataServis when shown + */ +void FitPropertyBrowser::showEvent(QShowEvent* e) { - populateFunctionNames(); + (void)e; + // Observe what workspaces are added and deleted unless it's a custom fitting, all workspaces for custom fitting (eg muon analysis) + // should be manually added. + if (!m_customFittings) + { + observeAdd(); + } + observePostDelete(); populateWorkspaceNames(); } +/** + * Disconnect from the AnalysisDataServis when hiden + */ +void FitPropertyBrowser::hideEvent(QHideEvent* e) +{ + (void)e; + observeAdd(false); + observePostDelete(false); +} + /// workspace was added void FitPropertyBrowser::addHandle(const std::string& wsName,const boost::shared_ptr<Mantid::API::Workspace> ws) {