Mantid
Loading...
Searching...
No Matches
FitOptionsBrowser.cpp
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 +
8
15
16#include "MantidQtWidgets/Common/QtPropertyBrowser/qtpropertymanager.h"
17#include "MantidQtWidgets/Common/QtPropertyBrowser/qttreepropertybrowser.h"
18// Suppress a warning coming out of code that isn't ours
19#if defined(__INTEL_COMPILER)
20#pragma warning disable 1125
21#elif defined(__GNUC__)
22#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
23#pragma GCC diagnostic push
24#endif
25#pragma GCC diagnostic ignored "-Woverloaded-virtual"
26#endif
27#include "MantidQtWidgets/Common/QtPropertyBrowser/ButtonEditorFactory.h"
28#include "MantidQtWidgets/Common/QtPropertyBrowser/CompositeEditorFactory.h"
29#include "MantidQtWidgets/Common/QtPropertyBrowser/DoubleEditorFactory.h"
30#include "MantidQtWidgets/Common/QtPropertyBrowser/qteditorfactory.h"
31#if defined(__INTEL_COMPILER)
32#pragma warning enable 1125
33#elif defined(__GNUC__)
34#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
35#pragma GCC diagnostic pop
36#endif
37#endif
38
39#include <QMessageBox>
40#include <QSettings>
41#include <QVBoxLayout>
42#include <limits>
43
45
52 : QWidget(parent), m_fittingTypeProp(nullptr), m_minimizer(nullptr), m_decimals(6), m_fittingType(fitType) {
53 // create m_browser
56
57 auto *layout = new QVBoxLayout(this);
58 layout->addWidget(m_browser);
59 layout->setContentsMargins(0, 0, 0, 0);
60}
61
63 m_browser->unsetFactoryForManager(m_stringManager);
64 m_browser->unsetFactoryForManager(m_doubleManager);
65 m_browser->unsetFactoryForManager(m_intManager);
66 m_browser->unsetFactoryForManager(m_boolManager);
67 m_browser->unsetFactoryForManager(m_enumManager);
68}
69
74 /* Create property managers: they create, own properties, get and set values
75 */
76 m_stringManager = new QtStringPropertyManager(this);
77 m_doubleManager = new QtDoublePropertyManager(this);
78 m_intManager = new QtIntPropertyManager(this);
79 m_boolManager = new QtBoolPropertyManager(this);
80 m_enumManager = new QtEnumPropertyManager(this);
81 m_groupManager = new QtGroupPropertyManager(this);
82
83 // create editor factories
84 auto *spinBoxFactory = new QtSpinBoxFactory(this);
85 auto *doubleEditorFactory = new DoubleEditorFactory(this);
86 auto *lineEditFactory = new QtLineEditFactory(this);
87 auto *checkBoxFactory = new QtCheckBoxFactory(this);
88 auto *comboBoxFactory = new QtEnumEditorFactory(this);
89
90 m_browser = new QtTreePropertyBrowser(nullptr, QStringList(), false);
91 // assign factories to property managers
92 m_browser->setFactoryForManager(m_stringManager, lineEditFactory);
93 m_browser->setFactoryForManager(m_doubleManager, doubleEditorFactory);
94 m_browser->setFactoryForManager(m_intManager, spinBoxFactory);
95 m_browser->setFactoryForManager(m_boolManager, checkBoxFactory);
96 m_browser->setFactoryForManager(m_enumManager, comboBoxFactory);
97
98 // m_browser->setContextMenuPolicy(Qt::CustomContextMenu);
99 // connect(m_browser, SIGNAL(customContextMenuRequested(const QPoint &)),
100 // this, SLOT(popupMenu(const QPoint &)));
101
102 connect(m_enumManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(enumChanged(QtProperty *)));
103 connect(m_doubleManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(doubleChanged(QtProperty *)));
104 // Fill in getter and setter maps
105}
106
112 m_fittingTypeProp = m_enumManager->addProperty("Fitting");
113 QStringList types;
114 types << "Sequential"
115 << "Simultaneous";
116 m_enumManager->setEnumNames(m_fittingTypeProp, types);
118 m_browser->addProperty(m_fittingTypeProp);
121 }
122}
123
132 }
135 }
137}
138
140 // Create MaxIterations property
141 m_maxIterations = m_intManager->addProperty("Max Iterations");
142 {
143 m_intManager->setValue(m_maxIterations, 500);
144 m_intManager->setMinimum(m_maxIterations, 0);
145 m_browser->addProperty(m_maxIterations);
146
149 }
150
151 // Set up the minimizer property.
152 //
153 // Create the enclosing group property. This group contains
154 // the minimizer name plus any properties of its own
155 m_minimizerGroup = m_groupManager->addProperty("Minimizer");
156 {
157 // Add the name property to the group
158 m_minimizer = m_enumManager->addProperty("Name");
159 m_minimizerGroup->addSubProperty(m_minimizer);
160
161 // Get names of registered minimizers from the factory
162 std::vector<std::string> minimizerOptions = Mantid::API::FuncMinimizerFactory::Instance().getKeys();
163 QStringList minimizers;
164
165 // Store them in the m_minimizer enum property
166 for (auto &minimizerOption : minimizerOptions) {
167 minimizers << QString::fromStdString(minimizerOption);
168 }
169 m_enumManager->setEnumNames(m_minimizer, minimizers);
170 int i = m_enumManager->enumNames(m_minimizer).indexOf("Levenberg-Marquardt");
171 if (i >= 0) {
172 m_enumManager->setValue(m_minimizer, i);
173 }
174 m_browser->addProperty(m_minimizerGroup);
176 }
177
178 // Create cost function property
179 m_costFunction = m_enumManager->addProperty("Cost Function");
180 {
181 // Get names of registered cost functions from the factory
182 std::vector<std::string> costOptions = Mantid::API::CostFunctionFactory::Instance().getKeys();
183 QStringList costFunctions;
184 // Store them in the m_minimizer enum property
185 for (auto &costOption : costOptions) {
186 costFunctions << QString::fromStdString(costOption);
187 }
188 m_enumManager->setEnumNames(m_costFunction, costFunctions);
189 m_browser->addProperty(m_costFunction);
192 }
193
194 // Create EvaluationType property
195 m_evaluationType = m_enumManager->addProperty("Evaluate Function As");
196 {
197 QStringList evaluationTypes;
198 evaluationTypes << "CentrePoint"
199 << "Histogram";
200 m_enumManager->setEnumNames(m_evaluationType, evaluationTypes);
201 m_browser->addProperty(m_evaluationType);
204 }
205 // Create PeakRadius property
206 m_peakRadius = m_intManager->addProperty("Peak Radius");
207 {
208 m_intManager->setValue(m_peakRadius, 0);
209 m_intManager->setMinimum(m_peakRadius, 0);
210 m_browser->addProperty(m_peakRadius);
212 }
213}
214
216 // Create Output property
217 m_output = m_stringManager->addProperty("Output");
218 {
219 m_browser->addProperty(m_output);
222 }
223
224 // Create Ignore property
225 m_ignoreInvalidData = m_boolManager->addProperty("Ignore Invalid Data");
226 {
227 m_browser->addProperty(m_ignoreInvalidData);
231 }
232}
233
235 // Create FitType property, a property of algorithm PlotPeakByLogValue
236 m_plotPeakByLogValueFitType = m_enumManager->addProperty("Fit Type");
237 {
238 QStringList types;
239 types << "Sequential"
240 << "Individual";
241 m_enumManager->setEnumNames(m_plotPeakByLogValueFitType, types);
246 }
247
248 // Create OutputWorkspace property
249 m_outputWorkspace = m_stringManager->addProperty("OutputWorkspace");
250 {
254 }
255
256 // Create CreateOutput property
257 auto prop = m_boolManager->addProperty("Create Output");
258 {
261 }
262
263 // Create OutputCompositeMembers property
264 prop = m_boolManager->addProperty("Output Composite Members");
265 {
266 addProperty("OutputCompositeMembers", prop, &FitOptionsBrowser::getBoolProperty,
269 }
270
271 // Create ConvolveMembers property
272 prop = m_boolManager->addProperty("Convolve Members");
273 {
276 }
277
278 // Create PassWSIndexToFunction property
279 prop = m_boolManager->addProperty("Pass WS Index To Function");
280 {
281 addProperty("PassWSIndexToFunction", prop, &FitOptionsBrowser::getBoolProperty,
284 }
285
286 // Create LogValue property
287 m_logValue = m_enumManager->addProperty("Log Value");
288 {
289 // m_enumManager->setValue(m_logValue,0);
293 }
294
295 // Create LogValue property
296 m_plotParameter = m_enumManager->addProperty("Plot parameter");
297 {
301 }
302}
303
304void FitOptionsBrowser::addProperty(const QString &name, QtProperty *prop,
305 QString (FitOptionsBrowser::*getter)(QtProperty *) const,
306 void (FitOptionsBrowser::*setter)(QtProperty *, const QString &)) {
307 m_propertyNameMap[name] = prop;
308 m_getters[prop] = getter;
309 m_setters[prop] = setter;
310}
311
317void FitOptionsBrowser::removeProperty(const QString &name) {
318 if (m_propertyNameMap.contains(name)) {
319 const auto prop = m_propertyNameMap[name];
320 m_getters.remove(prop);
321 m_setters.remove(prop);
322 m_propertyNameMap.remove(name);
323 }
324}
325
326/* *********************
327 * ** Private Slots **
328 * *********************/
329
334void FitOptionsBrowser::enumChanged(QtProperty *prop) {
335 if (prop == m_minimizer) {
337 } else if (prop == m_fittingTypeProp) {
339 }
340}
341
345void FitOptionsBrowser::doubleChanged(QtProperty *property) { emit doublePropertyChanged(property->propertyName()); }
346
351 int i = m_enumManager->value(m_minimizer);
352 QString minimizerName = m_enumManager->enumNames(m_minimizer)[i];
353 m_minimizerGroup->setPropertyName("Minimizer " + minimizerName);
354
355 // Remove properties of the old minimizer
356 auto subProperties = m_minimizerGroup->subProperties();
357 foreach (QtProperty *prop, subProperties) {
358 if (prop != m_minimizer) {
359 m_minimizerGroup->removeSubProperty(prop);
360 removeProperty(prop->propertyName());
361 }
362 }
363
364 // Check if the new minimizer has its own properties
365 auto minimizer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(minimizerName.toStdString());
366
367 // Create and add properties to the minimizer group
368 auto minimizerProperties = minimizer->getProperties();
369 for (auto &minimizerProperty : minimizerProperties) {
370 auto prop = createPropertyProperty(minimizerProperty);
371 if (prop) {
372 m_minimizerGroup->addSubProperty(prop);
373 }
374 }
375}
376
381 const auto fittingMode = getCurrentFittingType();
382 if (fittingMode == FittingMode::SIMULTANEOUS) {
384 } else {
386 }
387}
388
393 foreach (QtProperty *prop, m_simultaneousProperties) { m_browser->addProperty(prop); }
394 foreach (QtProperty *prop, m_sequentialProperties) { m_browser->removeProperty(prop); }
396}
397
404 if (!property) {
405 throw std::runtime_error("Unable to create a QtProperty.");
406 }
407 QString propName = QString::fromStdString(property->name());
408 QtProperty *prop = nullptr;
409 if (auto prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<bool> *>(property)) {
410 prop = m_boolManager->addProperty(propName);
411 bool val = *prp;
412 m_boolManager->setValue(prop, val);
413 } else if (auto prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<double> *>(property)) {
414 prop = this->addDoubleProperty(propName);
415 double val = *prp;
416 m_doubleManager->setValue(prop, val);
417 } else if (auto prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<int> *>(property)) {
418 prop = m_intManager->addProperty(propName);
419 int val = *prp;
420 m_intManager->setValue(prop, val);
421 } else if (auto prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<size_t> *>(property)) {
422 prop = m_intManager->addProperty(propName);
423 size_t val = *prp;
424 m_intManager->setValue(prop, static_cast<int>(val));
425 } else if (auto prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<std::string> *>(property)) {
426 prop = m_stringManager->addProperty(propName);
427 QString val = QString::fromStdString(prp->value());
428 m_stringManager->setValue(prop, val);
429 } else if (dynamic_cast<Mantid::API::IWorkspaceProperty *>(property)) {
430 prop = m_stringManager->addProperty(propName);
431 m_stringManager->setValue(prop, QString::fromStdString(property->value()));
432 } else {
433 QMessageBox::warning(this, "Mantid - Error",
434 "Type of minimizer's property " + propName + " is not yet supported by the browser.");
435 return nullptr;
436 }
437
438 // Something bad happened in QtPropertyBrowser.
439 if (!prop) {
440 throw std::runtime_error("Failed to create a QtProperty.");
441 }
442
443 // set the tooltip from property doc string
444 QString toolTip = QString::fromStdString(property->documentation());
445 if (!toolTip.isEmpty()) {
446 prop->setToolTip(toolTip);
447 }
448
449 return prop;
450}
451
457 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
458 auto propertyName = p.key().toStdString();
459 if (fit.existsProperty(propertyName)) {
460 auto prop = p.value();
461 auto f = m_getters[prop];
462 fit.setPropertyValue(propertyName, (this->*f)(prop).toStdString());
463 }
464 }
465}
466
471QString FitOptionsBrowser::getProperty(const QString &name) const {
472 if (!m_propertyNameMap.contains(name)) {
473 throw std::runtime_error("Property " + name.toStdString() + " isn't supported by the browser.");
474 }
475 auto prop = m_propertyNameMap[name];
476 auto f = m_getters[prop];
477 return (this->*f)(prop);
478}
479
485void FitOptionsBrowser::setProperty(const QString &name, const QString &value) {
486 if (!m_propertyNameMap.contains(name)) {
487 throw std::runtime_error("Property " + name.toStdString() + " isn't supported by the browser.");
488 }
489 auto prop = m_propertyNameMap[name];
490 auto f = m_setters[prop];
491 (this->*f)(prop, value);
492}
493
497QString FitOptionsBrowser::getMinimizer(QtProperty * /*unused*/) const {
498 int i = m_enumManager->value(m_minimizer);
499 QString minimStr = m_enumManager->enumNames(m_minimizer)[i];
500
501 auto subProperties = m_minimizerGroup->subProperties();
502 if (subProperties.size() > 1) {
503 foreach (QtProperty *prop, subProperties) {
504 if (prop == m_minimizer)
505 continue;
506 if (prop->propertyManager() == m_stringManager) {
507 QString value = m_stringManager->value(prop);
508 if (!value.isEmpty()) {
509 minimStr += "," + prop->propertyName() + "=" + value;
510 }
511 } else {
512 minimStr += "," + prop->propertyName() + "=";
513 if (prop->propertyManager() == m_intManager) {
514 minimStr += QString::number(m_intManager->value(prop));
515 } else if (prop->propertyManager() == m_doubleManager) {
516 minimStr += QString::number(m_doubleManager->value(prop));
517 } else if (prop->propertyManager() == m_boolManager) {
518 minimStr += QString::number(m_boolManager->value(prop));
519 } else {
520 throw std::runtime_error("The fit browser doesn't support the type "
521 "of minimizer's property " +
522 prop->propertyName().toStdString());
523 }
524 }
525 } // foreach
526 }
527 return minimStr;
528}
529
534void FitOptionsBrowser::setMinimizer(QtProperty * /*unused*/, const QString &value) {
535 QStringList terms = value.split(',');
536 int i = m_enumManager->enumNames(m_minimizer).indexOf(terms[0]);
537 m_enumManager->setValue(m_minimizer, i);
538}
539
540// ------------------------- Generic setters and getters
541// ------------------------------//
542
547QString FitOptionsBrowser::getIntProperty(QtProperty *prop) const { return QString::number(m_intManager->value(prop)); }
548
554void FitOptionsBrowser::setIntProperty(QtProperty *prop, const QString &value) {
555 m_intManager->setValue(prop, value.toInt());
556}
557
563QString FitOptionsBrowser::getDoubleProperty(QtProperty *prop) const {
564 return QString::number(m_doubleManager->value(prop));
565}
566
572void FitOptionsBrowser::setDoubleProperty(QtProperty *prop, const QString &value) {
573 m_doubleManager->setValue(prop, value.toDouble());
574}
575
580QString FitOptionsBrowser::getBoolProperty(QtProperty *prop) const {
581 return QString::number(m_boolManager->value(prop));
582}
583
589void FitOptionsBrowser::setBoolProperty(QtProperty *prop, const QString &value) {
590 bool boolValue = (value == "1") || (value.toLower() == "true");
591 m_boolManager->setValue(prop, boolValue);
592}
593
598QString FitOptionsBrowser::getStringEnumProperty(QtProperty *prop) const {
599 int i = m_enumManager->value(prop);
600 if (i < 0)
601 return "";
602 return m_enumManager->enumNames(prop)[i];
603}
604
610void FitOptionsBrowser::setStringEnumProperty(QtProperty *prop, const QString &value) {
611 int i = m_enumManager->enumNames(prop).indexOf(value);
612 if (i >= 0)
613 m_enumManager->setValue(prop, i);
614}
615
620QString FitOptionsBrowser::getStringProperty(QtProperty *prop) const { return m_stringManager->value(prop); }
621
627void FitOptionsBrowser::setStringProperty(QtProperty *prop, const QString &value) {
628 m_stringManager->setValue(prop, value);
629}
630
631// ------------------------------------------------------------------------------------//
632
637void FitOptionsBrowser::saveSettings(QSettings &settings) const {
638 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
639 auto prop = p.value();
640 auto f = m_getters[prop];
641 settings.setValue(p.key(), (this->*f)(prop));
642 }
643}
644
649void FitOptionsBrowser::loadSettings(const QSettings &settings) {
650 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
651 QString value = settings.value(p.key()).toString();
652 if (!value.isEmpty()) {
653 auto prop = p.value();
654 auto f = m_setters[prop];
655 (this->*f)(prop, value);
656 }
657 }
658}
659
666 return static_cast<FittingMode>(value);
667}
668
674 if (fitType == FittingMode::SIMULTANEOUS) {
675 m_enumManager->setValue(m_fittingTypeProp, 1);
676 } else {
677 m_enumManager->setValue(m_fittingTypeProp, 0);
678 }
679}
680
687 setCurrentFittingType(fitType);
688 m_fittingTypeProp->setEnabled(false);
689}
690
695
701void FitOptionsBrowser::setPropertyEnumValues(QtProperty *prop, const QStringList &values) {
702 auto i = m_enumManager->value(prop);
703 if (!values.isEmpty() && values.front().isEmpty()) {
704 m_enumManager->setEnumNames(prop, values);
705 } else {
706 QStringList names = values;
707 names.insert(0, "");
708 m_enumManager->setEnumNames(prop, names);
709 }
710 if (i < values.size()) {
711 m_enumManager->setValue(prop, i);
712 } else {
713 m_enumManager->setValue(prop, 0);
714 }
715}
716
721void FitOptionsBrowser::setLogNames(const QStringList &logNames) { setPropertyEnumValues(m_logValue, logNames); }
722
726void FitOptionsBrowser::setParameterNamesForPlotting(const QStringList &parNames) {
728}
729
735 auto i = m_enumManager->value(m_plotParameter);
736 if (i < 0)
737 i = 0;
738 return m_enumManager->enumNames(m_plotParameter)[i];
739}
740
741/* *************************
742 * ** Protected Members **
743 * *************************/
744
752QtProperty *FitOptionsBrowser::addDoubleProperty(const QString &propertyName) {
753 if (m_propertyNameMap.contains(propertyName)) {
754 throw std::runtime_error("Property " + propertyName.toStdString() + " already added.");
755 }
756 QtProperty *property = m_doubleManager->addProperty(propertyName);
757 m_doubleManager->setDecimals(property, m_decimals);
758 m_doubleManager->setRange(property, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
759 this->addProperty(propertyName, property, &FitOptionsBrowser::getDoubleProperty,
761 return property;
762}
763
773void FitOptionsBrowser::displayProperty(const QString &propertyName, bool show) {
774 if (!m_propertyNameMap.contains(propertyName)) {
775 throw std::runtime_error("Property " + propertyName.toStdString() + " isn't supported by the browser.");
776 }
777 auto prop = m_propertyNameMap[propertyName];
778 if (show) {
779 m_browser->addProperty(prop);
780 } else {
781 m_browser->removeProperty(prop);
782 }
783}
784
789 if (!m_propertyNameMap.contains(name)) {
790 return false;
791 }
792 auto prop = m_propertyNameMap[name];
793 m_sequentialProperties.removeAll(prop);
794 m_simultaneousProperties.removeAll(prop);
795 m_browser->removeProperty(prop);
796 return true;
797}
798
803 foreach (QtProperty *prop, m_sequentialProperties) { m_browser->addProperty(prop); }
804 foreach (QtProperty *prop, m_simultaneousProperties) { m_browser->removeProperty(prop); }
806}
807
808} // namespace MantidQt::MantidWidgets
double value
The value of the point.
Definition: FitMW.cpp:51
Class FitOptionsBrowser implements QtPropertyBrowser to display and set properties of Fit algorithm (...
QString getDoubleProperty(QtProperty *) const
Get the value of a double algorithm property.
QtProperty * m_evaluationType
EvaluationType property.
void addProperty(const QString &name, QtProperty *prop, QString(FitOptionsBrowser::*getter)(QtProperty *) const, void(FitOptionsBrowser::*setter)(QtProperty *, const QString &))
void createProperties()
Create browser's QtProperties.
QString getProperty(const QString &name) const
Get a string representation of a Fit's property value.
QString getIntProperty(QtProperty *) const
Get the value of an integer algorithm property.
FitOptionsBrowser(QWidget *parent=nullptr, FittingMode fitType=FittingMode::SIMULTANEOUS)
Constructor.
void displaySequentialFitProperties()
Show sequential fit (PlotPeakByLogValue) properties and hide the others.
QtProperty * m_ignoreInvalidData
IgnoreInvalidData property.
QtStringPropertyManager * m_stringManager
Manager for string properties.
QtProperty * m_plotPeakByLogValueFitType
PlotPeakByLogValue FitType property.
QtProperty * createPropertyProperty(Mantid::Kernel::Property *prop)
Create a QtProperty for an Algorithm Property and attach it to the correct manager.
void setBoolProperty(QtProperty *, const QString &)
Set a new value of a bool algorithm property.
QtProperty * m_minimizerGroup
Minimizer group property.
void loadSettings(const QSettings &settings)
Load property values from settings.
QMap< QtProperty *, GetterType > m_getters
Store for the properties getter methods.
void displayNormalFitProperties()
Show normal Fit properties and hide the others.
void updateMinimizer()
Update the browser when minimizer changes.
QString getParameterToPlot() const
Get name of a function parameter to plot against LogValue after sequential fitting.
QtDoublePropertyManager * m_doubleManager
Manager for double properties.
QtProperty * addDoubleProperty(const QString &propertyName)
Declares a property of type double, inserting it in the QMap attributes.
void doubleChanged(QtProperty *property)
pass the signal emitted by m_doubleManager
void createBrowser()
Create the Qt property browser and set up property managers.
bool addPropertyToBlacklist(const QString &)
Adds the property with the given name to a blacklist of properties to hide.
QMap< QString, QtProperty * > m_propertyNameMap
Maps algorithm property name to the QtProperty.
void setIntProperty(QtProperty *, const QString &)
Set a new value of an integer algorithm property.
QString getBoolProperty(QtProperty *) const
Get the value of a bool algorithm property.
void setCurrentFittingType(FittingMode fitType)
Set the current fitting type, ie which algorithm to use: Simultaneous for Fit and Sequential for Plot...
QString getStringProperty(QtProperty *) const
Get the value of a string algorithm property.
void doublePropertyChanged(const QString &propertyName)
void setPropertyEnumValues(QtProperty *prop, const QStringList &values)
Set values for an enum property.
void setStringProperty(QtProperty *, const QString &)
Set a new value of a string algorithm property.
int m_decimals
Precision of doubles in m_doubleManager.
QtProperty * m_logValue
LogValue property.
QtProperty * m_maxIterations
MaxIterations property.
QString getStringEnumProperty(QtProperty *) const
Get the value of a string algorithm property with predefined set of values.
QtProperty * m_plotParameter
Property for a name of a parameter to plot against LogValue.
FittingMode m_fittingType
The Fitting Type.
void setLogNames(const QStringList &logNames)
Define log names to use with the LogValue property.
QtBoolPropertyManager * m_boolManager
Manager for bool properties.
void setParameterNamesForPlotting(const QStringList &parNames)
Define names of function parameters that can be plotted against the LogValue.
void enumChanged(QtProperty *)
Update the browser when an enum property changes.
void setStringEnumProperty(QtProperty *, const QString &)
Set a new value of a string algorithm property with predefined set of values.
QList< QtProperty * > m_simultaneousProperties
Store special properties of the normal Fit.
QMap< QtProperty *, SetterType > m_setters
Store for the properties setter methods.
void initFittingTypeProp()
Initialize the fitting type property.
QtProperty * m_minimizer
Minimizer property.
void setMinimizer(QtProperty *, const QString &)
Set new value to the Minimizer property.
void switchFitType()
Switch the current fit type according to the value in the FitType property.
QtEnumPropertyManager * m_enumManager
Manager for the string list properties.
void displayProperty(const QString &propertyName, bool show=true)
Show or hide in the browser a supported property.
QtGroupPropertyManager * m_groupManager
Manager for groups of properties.
void setDoubleProperty(QtProperty *, const QString &)
Set a new value of a double algorithm property.
void lockCurrentFittingType(FittingMode fitType)
Lock the browser in a particular fitting type state.
QList< QtProperty * > m_sequentialProperties
Store special properties of the sequential Fit.
QtTreePropertyBrowser * m_browser
Qt property browser which displays properties.
QtIntPropertyManager * m_intManager
Manager for int properties.
QtProperty * m_outputWorkspace
OutputWorkspace property.
void setProperty(const QString &name, const QString &value)
Set a new value to a Fit's property.
void copyPropertiesToAlgorithm(Mantid::API::IAlgorithm &fit) const
Copy values of the properties to an algorithm.
QString getMinimizer(QtProperty *) const
Get the value of the Minimizer property.
QtProperty * m_fittingTypeProp
FitType property.
void saveSettings(QSettings &settings) const
Save the last property values in settings.
QtProperty * m_peakRadius
Peak radius property.
void unlockCurrentFittingType()
Make the fitting type changeable again.
FittingMode getCurrentFittingType() const
Get the current fitting type, ie which algorithm to use: Simultaneous for Fit and Sequential for Plot...
void removeProperty(const QString &name)
Remove a property previously added with addProperty (If property doesn't exist, does nothing).
QtProperty * m_costFunction
CostFunction property.
IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:45
An interface that is implemented by WorkspaceProperty.
virtual void setPropertyValue(const std::string &name, const std::string &value)=0
Sets property value from a string.
virtual bool existsProperty(const std::string &name) const =0
Checks whether the named property is already in the list of managed property.
The concrete, templated class for properties.
Base class for properties.
Definition: Property.h:94
const std::string & documentation() const
Get the property's documentation string.
Definition: Property.cpp:65
const std::string & name() const
Get the property's name.
Definition: Property.cpp:60
virtual std::string value() const =0
Returns the value of the property as a string.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...