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 const &getter,
70 PropertySetter const &setter);
71
72 void setStringProperty(QtProperty *prop, std::string const &value);
73 std::string getStringProperty(QtProperty *prop) const;
74
75 void setIntProperty(QtProperty *prop, std::string const &value);
76 std::string getIntProperty(QtProperty *prop) const;
77
78 void setStringEnumProperty(QtProperty *prop, std::string const &value);
79 std::string getStringEnumProperty(QtProperty *prop) const;
80
81 QtProperty *getQtPropertyFor(std::string const &name) const;
82
84 QtStringPropertyManager *m_stringManager;
85 QtIntPropertyManager *m_intManager;
86 QtEnumPropertyManager *m_enumManager;
87 QtBoolPropertyManager *m_boolManager;
88
90 QtProperty *m_fittingMode;
91 QtProperty *m_maxIterations;
92 QtProperty *m_minimizer;
93 QtProperty *m_costFunction;
94 QtProperty *m_evaluationType;
95 QtProperty *m_outputBaseName;
96 QtProperty *m_plotOutput;
97
99 QtTreePropertyBrowser *m_browser;
100
102 QMap<std::string, QtProperty *> m_propertyNameMap;
104 QMap<QtProperty *, PropertySetter> m_setters;
106 QMap<QtProperty *, PropertyGetter> m_getters;
107};
108
109} // namespace MantidWidgets
110} // namespace MantidQt
std::string name
Definition Run.cpp:60
#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...
STL namespace.