Mantid
Loading...
Searching...
No Matches
FunctionBrowser.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "DllOption.h"
10
11#include "MantidAPI/IFunction.h"
14
15#include <QWidget>
16
17#include <boost/optional.hpp>
18#include <memory>
19
20namespace Mantid {
21namespace API {
22class CompositeFunction;
23class Workspace;
24class ParameterTie;
25} // namespace API
26} // namespace Mantid
27
28namespace MantidQt {
29namespace MantidWidgets {
30
31class FunctionTreeView;
32class FunctionMultiDomainPresenter;
33
34using namespace Mantid::API;
35
41 Q_OBJECT
42public:
44 FunctionBrowser(QWidget *parent = nullptr, bool multi = false,
45 const std::vector<std::string> &categories = std::vector<std::string>());
47 virtual ~FunctionBrowser() override;
49 void clear() override;
51 void setFunction(const QString &funStr) override;
53 void setFunction(IFunction_sptr fun);
55 QString getFunctionString() override;
57 IFunction_sptr getFunction();
59 bool hasFunction() const;
61 IFunction_sptr getFunctionByIndex(const QString &index);
63 boost::optional<QString> currentFunctionIndex();
65 void setParameter(const QString &paramName, double value);
67 void setParameterError(const QString &paramName, double error);
69 double getParameter(const QString &paramName) const;
71 void updateParameters(const IFunction &fun) override;
73 QStringList getGlobalParameters() const;
74 void setGlobalParameters(const QStringList &globals);
76 QStringList getLocalParameters() const;
78 int getNumberOfDatasets() const override;
80 QStringList getDatasetNames() const override;
82 QStringList getDatasetDomainNames() const override;
84 double getLocalParameterValue(const QString &parName, int i) const override;
86 void setLocalParameterValue(const QString &parName, int i, double value) override;
88 void setLocalParameterValue(const QString &parName, int i, double value, double error);
90 double getLocalParameterError(const QString &parName, int i) const;
92 bool isLocalParameterFixed(const QString &parName, int i) const override;
94 void setLocalParameterFixed(const QString &parName, int i, bool fixed) override;
96 QString getLocalParameterTie(const QString &parName, int i) const override;
98 void setLocalParameterTie(const QString &parName, int i, QString tie) override;
100 IFunction_sptr getGlobalFunction() override;
102 void updateMultiDatasetParameters(const IFunction &fun) override;
104 void updateMultiDatasetAttributes(const IFunction &fun);
107 void updateMultiDatasetParameters(const ITableWorkspace &paramTable) override;
109 int getCurrentDataset() const override;
111 void setColumnSizes(int s0, int s1, int s2 = -1);
113 void setStretchLastColumn(bool stretch);
115 void setErrorsEnabled(bool enabled) override;
117 void clearErrors() override;
119 void setBackgroundA0(double value);
120 // hide the global options
121 void hideGlobalCheckbox();
122 // show the global options
123 void showGlobalCheckbox();
124
125signals:
126 void parameterChanged(const QString &funcIndex, const QString &paramName);
127 void attributeChanged(const QString &attributeName);
131
133 void localParameterButtonClicked(const QString &parName);
135
136public slots:
137
138 // Handling of multiple datasets
139 void setNumberOfDatasets(int n) override;
140 void setDatasets(const QStringList &datasetNames) override;
141 void setDatasets(const QList<FunctionModelDataset> &datasets) override;
142 void resetLocalParameters();
143 void setCurrentDataset(int i) override;
144 void removeDatasets(const QList<int> &indices);
145 void addDatasets(const QStringList &names);
146
147protected:
148 std::unique_ptr<FunctionMultiDomainPresenter> m_presenter;
149
150public:
151 // Intended for testing only
152 FunctionTreeView *view() const;
153 QString getFitFunctionString() const;
154};
155
156} // namespace MantidWidgets
157} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
double value
The value of the point.
Definition: FitMW.cpp:51
double error
Definition: IndexPeaks.cpp:133
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Class FitPropertyBrowser implements QtPropertyBrowser to display and control fitting function paramet...
void parameterChanged(const QString &funcIndex, const QString &paramName)
void attributeChanged(const QString &attributeName)
virtual ~FunctionBrowser() override
Destructor.
std::unique_ptr< FunctionMultiDomainPresenter > m_presenter
void currentFunctionChanged()
User selects a different function (or one of it's sub-properties)
void localParameterButtonClicked(const QString &parName)
In multi-dataset context a button value editor was clicked.
Class FitPropertyBrowser implements QtPropertyBrowser to display and control fitting function paramet...
IFunctionBrowser: interface for FunctionBrowser.
This is an interface to a fitting function - a semi-abstarct class.
Definition: IFunction.h:163
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
Helper class which provides the Collimation Length for SANS instruments.