Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "DllOption.h"
#include "MantidQtWidgets/Common/FittingMode.h"
#include <QMap>
#include <QWidget>
/* Forward declarations */
class QtProperty;
class QtTreePropertyBrowser;
class QtDoublePropertyManager;
class QtIntPropertyManager;
class QtBoolPropertyManager;
class QtStringPropertyManager;
class QtEnumPropertyManager;
class QtGroupPropertyManager;
class QSettings;
namespace Mantid {
namespace Kernel {
class Property;
}
namespace API {
class IAlgorithm;
}
} // namespace Mantid
namespace MantidQt {
namespace MantidWidgets {
/**
* Class FitOptionsBrowser implements QtPropertyBrowser to display
* and set properties of Fit algorithm (excluding Function and Workspace)
*
*/
class EXPORT_OPT_MANTIDQT_COMMON BasicFitOptionsBrowser : public QWidget {
Q_OBJECT
public:
BasicFitOptionsBrowser(QWidget *parent = nullptr,
FittingMode fitType = FittingMode::SIMULTANEOUS);
~BasicFitOptionsBrowser();
void setProperty(const QString &name, const QString &value);
FittingMode getCurrentFittingType() const;
void setCurrentFittingType(FittingMode fitType);
signals:
void changedToSequentialFitting();
void changedToSimultaneousFitting();
private slots:
void enumChanged(QtProperty * /*prop*/);
private:
void createBrowser();
void initFittingTypeProp();
void createProperties();
void createCommonProperties();
void switchFitType();
void addProperty(const QString &name, QtProperty *prop,
QString (BasicFitOptionsBrowser::*getter)(QtProperty *)
const,
void (BasicFitOptionsBrowser::*setter)(QtProperty *,
const QString &));
QString getIntProperty(QtProperty * /*prop*/) const;
void setIntProperty(QtProperty * /*prop*/, const QString & /*value*/);
QString getStringEnumProperty(QtProperty * /*prop*/) const;
void setStringEnumProperty(QtProperty * /*prop*/, const QString & /*value*/);
/// Manager for int properties
QtIntPropertyManager *m_intManager;
/// Manager for the string list properties
QtEnumPropertyManager *m_enumManager;
/// FitType property
QtProperty *m_fittingTypeProp;
/// Minimizer property
QtProperty *m_minimizer;
/// CostFunction property
QtProperty *m_costFunction;
/// MaxIterations property
QtProperty *m_maxIterations;
/// EvaluationType property
QtProperty *m_evaluationType;
/// Qt property browser which displays properties
QtTreePropertyBrowser *m_browser;
/// Precision of doubles in m_doubleManager
int m_decimals;
using SetterType = void (BasicFitOptionsBrowser::*)(QtProperty *,
const QString &);
using GetterType = QString (BasicFitOptionsBrowser::*)(QtProperty *) const;
/// Maps algorithm property name to the QtProperty
QMap<QString, QtProperty *> m_propertyNameMap;
/// Store for the properties setter methods
QMap<QtProperty *, SetterType> m_setters;
/// Store for the properties getter methods
QMap<QtProperty *, GetterType> m_getters;
/// The Fitting Type
FittingMode m_fittingType;
QList<QtProperty *> m_blacklist;
};
} // namespace MantidWidgets
} // namespace MantidQt