diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h index 04b1e2dace4fa41768b6cdc2f0534bd0ccd408ab..9722673e226eafd02a1d6fb65e2db4ad5e46eb0a 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h @@ -18,6 +18,7 @@ /// shahroz #include "MantidQtMantidWidgets/PeakPicker.h" + #include "MantidAPI/IPeakFunction.h" @@ -187,8 +188,9 @@ public: /// @shahroz void setPeakPickerEnabled(bool enabled) override; - // void setPeakPicker(const IPeakFunction_const_sptr &peak) override; + void setPeakPicker(const Mantid::API::IPeakFunction_const_sptr &peak) override; + QPoint getQPoint(); private slots: /// for buttons, do calibrate, focus, event->histo rebin, and similar @@ -247,6 +249,8 @@ private slots: void fittingListWidgetBank(int idx); void setListWidgetBank(int idx); + /// @shahroz + void warningWithXY(); // show the standard Mantid help window with this interface's help void openHelpWin(); @@ -313,6 +317,9 @@ private: int static m_bank_Id; + /// @shahroz + QPoint static m_plotPos; + /// current calibration produced in the 'Calibration' tab std::string m_currentCalibFilename; /// calibration settings - from/to the 'settings' tab diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h index 3e8811f24baefddc34218293b344868ad3f8dd95..36a1650b6445cdd2eb49a3763fc8ea912637c18f 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h @@ -436,8 +436,7 @@ public: virtual void setPeakPickerEnabled(bool enabled) = 0; - //virtual void setPeakPicker(const IPeakFunction_const_sptr &peak) = 0; - + virtual void setPeakPicker(const Mantid::API::IPeakFunction_const_sptr &peak) = 0; }; diff --git a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp index 8ac7f11988a3519255fb40d65f46ea83b0da468f..558a0dfb4387dc565f5b7ffe261b5f42a9dc0eb3 100644 --- a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp +++ b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp @@ -35,6 +35,7 @@ int EnggDiffractionViewQtGUI::m_currentType = 0; int EnggDiffractionViewQtGUI::m_currentRunMode = 0; int EnggDiffractionViewQtGUI::m_currentCropCalibBankName = 0; int EnggDiffractionViewQtGUI::m_bank_Id = 0; +QPoint EnggDiffractionViewQtGUI::m_plotPos = QPoint(0, 0); const std::string EnggDiffractionViewQtGUI::g_iparmExtStr = "GSAS instrument parameters, IPARM file: PRM, PAR, IPAR, IPARAM " @@ -204,6 +205,10 @@ void EnggDiffractionViewQtGUI::doSetupTabPreproc() { } void EnggDiffractionViewQtGUI::doSetupTabFitting() { + // constructor of the peakPicker + m_peakPicker = + new MantidWidgets::PeakPicker(m_uiTabFitting.dataPlot, Qt::red); + connect(m_uiTabFitting.pushButton_fitting_browse_run_num, SIGNAL(released()), this, SLOT(browseFitFocusedRun())); @@ -233,9 +238,6 @@ void EnggDiffractionViewQtGUI::doSetupTabFitting() { QFont font("MS Shell Dlg 2", 8); m_uiTabFitting.dataPlot->setAxisFont(QwtPlot::xBottom, font); m_uiTabFitting.dataPlot->setAxisFont(QwtPlot::yLeft, font); - - m_peakPicker = new MantidWidgets::PeakPicker(m_uiTabFitting.dataPlot, Qt::red); - } void EnggDiffractionViewQtGUI::doSetupTabSettings() { @@ -895,26 +897,28 @@ void EnggDiffractionViewQtGUI::loadCalibrationClicked() { m_presenter->notify(IEnggDiffractionPresenter::LoadExistingCalib); } +Mantid::API::IPeakFunction_const_sptr +EnggDiffractionViewQtGUI::peakPicker() const { + return m_peakPicker->peak(); +} -Mantid::API::IPeakFunction_const_sptr EnggDiffractionViewQtGUI::peakPicker() const -{ - return m_peakPicker->peak(); +void EnggDiffractionViewQtGUI::setPeakPickerEnabled(bool enabled) { + m_peakPicker->setEnabled(enabled); + m_peakPicker->setVisible(enabled); + m_uiTabFitting.dataPlot->replot(); // PeakPicker might get hidden/shown } -void EnggDiffractionViewQtGUI::setPeakPickerEnabled(bool enabled) -{ - m_peakPicker->setEnabled(enabled); - m_peakPicker->setVisible(enabled); - m_uiTabFitting.dataPlot->replot(); // PeakPicker might get hidden/shown +void EnggDiffractionViewQtGUI::setPeakPicker( + const IPeakFunction_const_sptr &peak) { + m_peakPicker->setPeak(peak); + m_uiTabFitting.dataPlot->replot(); } -/* -void EnggDiffractionViewQtGUI::setPeakPicker(const IPeakFunction_const_sptr &peak) -{ - m_peakPicker->setPeak(peak); - m_uiTabFitting.dataPlot->replot(); +QPoint EnggDiffractionViewQtGUI::getQPoint() { + auto pos = m_uiTabFitting.dataPlot->pos(); + return pos; } -*/ + void EnggDiffractionViewQtGUI::calibrateClicked() { m_presenter->notify(IEnggDiffractionPresenter::CalcCalib); } @@ -1284,6 +1288,14 @@ void EnggDiffractionViewQtGUI::setListWidgetBank(int idx) { selectBank->setCurrentRow(idx); } +void MantidQt::CustomInterfaces::EnggDiffractionViewQtGUI::warningWithXY() { + auto x = getFittingPlotX(); + auto y = getFittingPlotY(); + + userWarning("X and Y value: ", "the X value is:" + std::to_string(x) + + ". the Y value is: " + std::to_string(y)); +} + void EnggDiffractionViewQtGUI::instrumentChanged(int /*idx*/) { QComboBox *inst = m_ui.comboBox_instrument; if (!inst)