Mantid
Loading...
Searching...
No Matches
FitScriptOptionsBrowser.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 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"
11
12#include <QMap>
13#include <QWidget>
14
15class QtProperty;
16class QtTreePropertyBrowser;
17class QtStringPropertyManager;
18class QtIntPropertyManager;
19class QtEnumPropertyManager;
20class QtBoolPropertyManager;
21
22namespace MantidQt {
23namespace MantidWidgets {
24
34 Q_OBJECT
35
36 using PropertySetter = void (FitScriptOptionsBrowser::*)(QtProperty *, std::string const &);
37 using PropertyGetter = std::string (FitScriptOptionsBrowser::*)(QtProperty *) const;
38
39public:
40 FitScriptOptionsBrowser(QWidget *parent = nullptr);
42
43 void setFittingMode(FittingMode fittingMode);
44 FittingMode getFittingMode() const;
45
46 void setProperty(std::string const &name, std::string const &value);
47 std::string getProperty(std::string const &name) const;
48 bool getBoolProperty(std::string const &name) const;
49
50signals:
51 void outputBaseNameChanged(std::string const &outputBaseName);
53
54private slots:
55 void stringChanged(QtProperty *prop);
56 void enumChanged(QtProperty *prop);
57
58private:
59 void createBrowser();
60 void createProperties();
61 void createFittingModeProperty();
62 void createMaxIterationsProperty();
63 void createMinimizerProperty();
64 void createCostFunctionProperty();
65 void createEvaluationTypeProperty();
66 void createOutputBaseNameProperty();
67 void createPlotOutputProperty();
68
69 void addProperty(std::string const &name, QtProperty *prop, PropertyGetter getter, PropertySetter setter);
70
71 void setStringProperty(QtProperty *prop, std::string const &value);
72 std::string getStringProperty(QtProperty *prop) const;
73
74 void setIntProperty(QtProperty *prop, std::string const &value);
75 std::string getIntProperty(QtProperty *prop) const;
76
77 void setStringEnumProperty(QtProperty *prop, std::string const &value);
78 std::string getStringEnumProperty(QtProperty *prop) const;
79
80 QtProperty *getQtPropertyFor(std::string const &name) const;
81
83 QtStringPropertyManager *m_stringManager;
84 QtIntPropertyManager *m_intManager;
85 QtEnumPropertyManager *m_enumManager;
86 QtBoolPropertyManager *m_boolManager;
87
89 QtProperty *m_fittingMode;
90 QtProperty *m_maxIterations;
91 QtProperty *m_minimizer;
92 QtProperty *m_costFunction;
93 QtProperty *m_evaluationType;
94 QtProperty *m_outputBaseName;
95 QtProperty *m_plotOutput;
96
98 QtTreePropertyBrowser *m_browser;
99
101 QMap<std::string, QtProperty *> m_propertyNameMap;
103 QMap<QtProperty *, PropertySetter> m_setters;
105 QMap<QtProperty *, PropertyGetter> m_getters;
106};
107
108} // namespace MantidWidgets
109} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
double value
The value of the point.
Definition: FitMW.cpp:51
The BasicFitOptionsBrowser class implements a QtPropertyBrowser to display fitting properties found i...
QtTreePropertyBrowser * m_browser
Qt property browser which displays properties.
QMap< std::string, QtProperty * > m_propertyNameMap
Maps algorithm property name to the QtProperty.
QMap< QtProperty *, PropertyGetter > m_getters
Store for the property getter methods.
QMap< QtProperty *, PropertySetter > m_setters
Store for the property setter methods.
std::string(FitScriptOptionsBrowser::*)(QtProperty *) const PropertyGetter
void fittingModeChanged(FittingMode fittingMode)
void(FitScriptOptionsBrowser::*)(QtProperty *, std::string const &) PropertySetter
void outputBaseNameChanged(std::string const &outputBaseName)
QtStringPropertyManager * m_stringManager
Property managers.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...