예제 #1
0
void ALCPeakFittingView::initialize() {
  m_ui.setupUi(m_widget);

  connect(m_ui.fit, SIGNAL(clicked()), this, SIGNAL(fitRequested()));

  m_ui.plot->setCanvasBackground(Qt::white);
  m_ui.plot->setAxisFont(QwtPlot::xBottom, m_widget->font());
  m_ui.plot->setAxisFont(QwtPlot::yLeft, m_widget->font());

  m_dataCurve->setStyle(QwtPlotCurve::NoCurve);
  m_dataCurve->setSymbol(
      QwtSymbol(QwtSymbol::Ellipse, QBrush(), QPen(), QSize(7, 7)));
  m_dataCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
  m_dataCurve->attach(m_ui.plot);

  m_fittedCurve->setPen(QPen(Qt::red, 1.5));
  m_fittedCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
  m_fittedCurve->attach(m_ui.plot);

  // XXX: Being a QwtPlotItem, should get deleted when m_ui.plot gets deleted
  // (auto-delete option)
  m_peakPicker = new MantidWidgets::PeakPicker(m_ui.plot, Qt::red);

  connect(m_peakPicker, SIGNAL(changed()), SIGNAL(peakPickerChanged()));

  connect(m_ui.peaks, SIGNAL(currentFunctionChanged()),
          SIGNAL(currentFunctionChanged()));
  connect(m_ui.peaks, SIGNAL(parameterChanged(QString, QString)),
          SIGNAL(parameterChanged(QString, QString)));

  connect(m_ui.help, SIGNAL(clicked()), this, SLOT(help()));
  connect(m_ui.plotGuess, SIGNAL(clicked()), this, SLOT(plotGuess()));
}
void IndirectFitPlotPresenter::updateGuess(bool doPlotGuess) {
  if (doPlotGuess) {
    const auto guessWorkspace = m_model->getGuessWorkspace();
    if (guessWorkspace->x(0).size() >= 2) {
      plotGuess(guessWorkspace);
      if (m_plotGuessInSeparateWindow)
        plotGuessInSeparateWindow(guessWorkspace);
    }
  } else if (m_plotGuessInSeparateWindow)
    plotGuessInSeparateWindow(m_model->getGuessWorkspace());
  else
    clearGuess();
}