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
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 const &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 const &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 m_ignoreInvalidData = m_boolManager->addProperty("Ignore Invalid Data");
215 {
216 m_browser->addProperty(m_ignoreInvalidData);
219 }
220}
221
231
233 // Create FitType property, a property of algorithm PlotPeakByLogValue
234 m_plotPeakByLogValueFitType = m_enumManager->addProperty("Fit Type");
235 {
236 QStringList types;
237 types << "Sequential"
238 << "Individual";
239 m_enumManager->setEnumNames(m_plotPeakByLogValueFitType, types);
244 }
245
246 // Create OutputWorkspace property
247 m_outputWorkspace = m_stringManager->addProperty("OutputWorkspace");
248 {
252 }
253
254 // Create CreateOutput property
255 auto prop = m_boolManager->addProperty("Create Output");
256 {
259 }
260
261 // Create OutputCompositeMembers property
262 prop = m_boolManager->addProperty("Output Composite Members");
263 {
264 addProperty("OutputCompositeMembers", prop, &FitOptionsBrowser::getBoolProperty,
267 }
268
269 // Create ConvolveMembers property
270 prop = m_boolManager->addProperty("Convolve Members");
271 {
274 }
275
276 // Create PassWSIndexToFunction property
277 prop = m_boolManager->addProperty("Pass WS Index To Function");
278 {
279 addProperty("PassWSIndexToFunction", prop, &FitOptionsBrowser::getBoolProperty,
282 }
283
284 // Create LogValue property
285 m_logValue = m_enumManager->addProperty("Log Value");
286 {
287 // m_enumManager->setValue(m_logValue,0);
291 }
292
293 // Create LogValue property
294 m_plotParameter = m_enumManager->addProperty("Plot parameter");
295 {
299 }
300}
301
302void FitOptionsBrowser::addProperty(const QString &name, QtProperty *prop,
303 QString (FitOptionsBrowser::*getter)(QtProperty *) const,
304 void (FitOptionsBrowser::*setter)(QtProperty *, const QString &)) {
305 m_propertyNameMap[name] = prop;
306 m_getters[prop] = getter;
307 m_setters[prop] = setter;
308}
309
316 if (m_propertyNameMap.contains(name)) {
317 auto const *prop = m_propertyNameMap[name];
318 m_getters.remove(prop);
319 m_setters.remove(prop);
320 m_propertyNameMap.remove(name);
321 }
322}
323
324/* *********************
325 * ** Private Slots **
326 * *********************/
327
332void FitOptionsBrowser::enumChanged(QtProperty *prop) {
333 if (prop == m_minimizer) {
335 } else if (prop == m_fittingTypeProp) {
337 }
338}
339
343void FitOptionsBrowser::doubleChanged(QtProperty *property) { emit doublePropertyChanged(property->propertyName()); }
344
349 int i = m_enumManager->value(m_minimizer);
350 QString minimizerName = m_enumManager->enumNames(m_minimizer)[i];
351 m_minimizerGroup->setPropertyName("Minimizer " + minimizerName);
352
353 // Remove properties of the old minimizer
354 auto subProperties = m_minimizerGroup->subProperties();
355 foreach (QtProperty *prop, subProperties) {
356 if (prop != m_minimizer) {
357 m_minimizerGroup->removeSubProperty(prop);
358 removeProperty(prop->propertyName());
359 }
360 }
361
362 // Check if the new minimizer has its own properties
363 auto minimizer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(minimizerName.toStdString());
364
365 // Create and add properties to the minimizer group
366 auto minimizerProperties = minimizer->getProperties();
367 for (auto const &minimizerProperty : minimizerProperties) {
368 auto prop = createPropertyProperty(minimizerProperty);
369 if (prop) {
370 m_minimizerGroup->addSubProperty(prop);
371 }
372 }
373}
374
379 const auto fittingMode = getCurrentFittingType();
380 if (fittingMode == FittingMode::SIMULTANEOUS) {
382 } else {
384 }
385}
386
391 foreach (QtProperty *prop, m_simultaneousProperties) {
392 m_browser->addProperty(prop);
393 }
394 foreach (QtProperty *prop, m_sequentialProperties) {
395 m_browser->removeProperty(prop);
396 }
398}
399
406 if (!property) {
407 throw std::runtime_error("Unable to create a QtProperty.");
408 }
409 QString propName = QString::fromStdString(property->name());
410 QtProperty *prop = nullptr;
411 if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<bool> const *>(property)) {
412 prop = m_boolManager->addProperty(propName);
413 bool val = *prp;
414 m_boolManager->setValue(prop, val);
415 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<double> const *>(property)) {
416 prop = this->addDoubleProperty(propName);
417 double val = *prp;
418 m_doubleManager->setValue(prop, val);
419 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<int> const *>(property)) {
420 prop = m_intManager->addProperty(propName);
421 int val = *prp;
422 m_intManager->setValue(prop, val);
423 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<size_t> const *>(property)) {
424 prop = m_intManager->addProperty(propName);
425 size_t val = *prp;
426 m_intManager->setValue(prop, static_cast<int>(val));
427 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<std::string> const *>(property)) {
428 prop = m_stringManager->addProperty(propName);
429 QString val = QString::fromStdString(prp->value());
430 m_stringManager->setValue(prop, val);
431 } else if (dynamic_cast<Mantid::API::IWorkspaceProperty const *>(property)) {
432 prop = m_stringManager->addProperty(propName);
433 m_stringManager->setValue(prop, QString::fromStdString(property->value()));
434 } else {
435 QMessageBox::warning(this, "Mantid - Error",
436 "Type of minimizer's property " + propName + " is not yet supported by the browser.");
437 return nullptr;
438 }
439
440 // Something bad happened in QtPropertyBrowser.
441 if (!prop) {
442 throw std::runtime_error("Failed to create a QtProperty.");
443 }
444
445 // set the tooltip from property doc string
446 QString toolTip = QString::fromStdString(property->documentation());
447 if (!toolTip.isEmpty()) {
448 prop->setToolTip(toolTip);
449 }
450
451 return prop;
452}
453
459 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
460 auto propertyName = p.key().toStdString();
461 if (fit.existsProperty(propertyName)) {
462 auto prop = p.value();
463 auto f = m_getters[prop];
464 fit.setPropertyValue(propertyName, (this->*f)(prop).toStdString());
465 }
466 }
467}
468
473QString FitOptionsBrowser::getProperty(const QString &name) const {
474 if (!m_propertyNameMap.contains(name)) {
475 throw std::runtime_error("Property " + name.toStdString() + " isn't supported by the browser.");
476 }
477 auto prop = m_propertyNameMap[name];
478 auto f = m_getters[prop];
479 return (this->*f)(prop);
480}
481
487void FitOptionsBrowser::setProperty(const QString &name, const QString &value) {
488 if (!m_propertyNameMap.contains(name)) {
489 throw std::runtime_error("Property " + name.toStdString() + " isn't supported by the browser.");
490 }
491 auto prop = m_propertyNameMap[name];
492 auto f = m_setters[prop];
493 (this->*f)(prop, value);
494}
495
499QString FitOptionsBrowser::getMinimizer(QtProperty * /*unused*/) const {
500 int i = m_enumManager->value(m_minimizer);
501 QString minimStr = m_enumManager->enumNames(m_minimizer)[i];
502
503 auto subProperties = m_minimizerGroup->subProperties();
504 if (subProperties.size() > 1) {
505 foreach (const QtProperty *prop, subProperties) {
506 if (prop == m_minimizer)
507 continue;
508 if (prop->propertyManager() == m_stringManager) {
509 QString value = m_stringManager->value(prop);
510 if (!value.isEmpty()) {
511 minimStr += "," + prop->propertyName() + "=" + value;
512 }
513 } else {
514 minimStr += "," + prop->propertyName() + "=";
515 if (prop->propertyManager() == m_intManager) {
516 minimStr += QString::number(m_intManager->value(prop));
517 } else if (prop->propertyManager() == m_doubleManager) {
518 minimStr += QString::number(m_doubleManager->value(prop));
519 } else if (prop->propertyManager() == m_boolManager) {
520 minimStr += QString::number(m_boolManager->value(prop));
521 } else {
522 throw std::runtime_error("The fit browser doesn't support the type "
523 "of minimizer's property " +
524 prop->propertyName().toStdString());
525 }
526 }
527 } // foreach
528 }
529 return minimStr;
530}
531
536void FitOptionsBrowser::setMinimizer(QtProperty * /*unused*/, const QString &value) {
537 QStringList terms = value.split(',');
538 int i = m_enumManager->enumNames(m_minimizer).indexOf(terms[0]);
539 m_enumManager->setValue(m_minimizer, i);
540}
541
542// ------------------------- Generic setters and getters
543// ------------------------------//
544
549QString FitOptionsBrowser::getIntProperty(QtProperty *prop) const { return QString::number(m_intManager->value(prop)); }
550
556void FitOptionsBrowser::setIntProperty(QtProperty *prop, const QString &value) {
557 m_intManager->setValue(prop, value.toInt());
558}
559
565QString FitOptionsBrowser::getDoubleProperty(QtProperty *prop) const {
566 return QString::number(m_doubleManager->value(prop));
567}
568
574void FitOptionsBrowser::setDoubleProperty(QtProperty *prop, const QString &value) {
575 m_doubleManager->setValue(prop, value.toDouble());
576}
577
582QString FitOptionsBrowser::getBoolProperty(QtProperty *prop) const {
583 return QString::number(m_boolManager->value(prop));
584}
585
591void FitOptionsBrowser::setBoolProperty(QtProperty *prop, const QString &value) {
592 bool boolValue = (value == "1") || (value.toLower() == "true");
593 m_boolManager->setValue(prop, boolValue);
594}
595
600QString FitOptionsBrowser::getStringEnumProperty(QtProperty *prop) const {
601 int i = m_enumManager->value(prop);
602 if (i < 0)
603 return "";
604 return m_enumManager->enumNames(prop)[i];
605}
606
612void FitOptionsBrowser::setStringEnumProperty(QtProperty *prop, const QString &value) {
613 int i = m_enumManager->enumNames(prop).indexOf(value);
614 if (i >= 0)
615 m_enumManager->setValue(prop, i);
616}
617
622QString FitOptionsBrowser::getStringProperty(QtProperty *prop) const { return m_stringManager->value(prop); }
623
629void FitOptionsBrowser::setStringProperty(QtProperty *prop, const QString &value) {
630 m_stringManager->setValue(prop, value);
631}
632
633// ------------------------------------------------------------------------------------//
634
639void FitOptionsBrowser::saveSettings(QSettings &settings) const {
640 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
641 auto prop = p.value();
642 auto f = m_getters[prop];
643 settings.setValue(p.key(), (this->*f)(prop));
644 }
645}
646
651void FitOptionsBrowser::loadSettings(const QSettings &settings) {
652 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
653 QString value = settings.value(p.key()).toString();
654 if (!value.isEmpty()) {
655 auto prop = p.value();
656 auto f = m_setters[prop];
657 (this->*f)(prop, value);
658 }
659 }
660}
661
670
676 if (fitType == FittingMode::SIMULTANEOUS) {
677 m_enumManager->setValue(m_fittingTypeProp, 1);
678 } else {
679 m_enumManager->setValue(m_fittingTypeProp, 0);
680 }
681}
682
689 setCurrentFittingType(fitType);
690 m_fittingTypeProp->setEnabled(false);
691}
692
697
703void FitOptionsBrowser::setPropertyEnumValues(QtProperty *prop, const QStringList &values) {
704 auto i = m_enumManager->value(prop);
705 if (!values.isEmpty() && values.front().isEmpty()) {
706 m_enumManager->setEnumNames(prop, values);
707 } else {
708 QStringList names = values;
709 names.insert(0, "");
710 m_enumManager->setEnumNames(prop, names);
711 }
712 if (i < values.size()) {
713 m_enumManager->setValue(prop, i);
714 } else {
715 m_enumManager->setValue(prop, 0);
716 }
717}
718
723void FitOptionsBrowser::setLogNames(const QStringList &logNames) { setPropertyEnumValues(m_logValue, logNames); }
724
728void FitOptionsBrowser::setParameterNamesForPlotting(const QStringList &parNames) {
730}
731
737 auto i = m_enumManager->value(m_plotParameter);
738 if (i < 0)
739 i = 0;
740 return m_enumManager->enumNames(m_plotParameter)[i];
741}
742
743/* *************************
744 * ** Protected Members **
745 * *************************/
746
754QtProperty *FitOptionsBrowser::addDoubleProperty(const QString &propertyName) {
755 if (m_propertyNameMap.contains(propertyName)) {
756 throw std::runtime_error("Property " + propertyName.toStdString() + " already added.");
757 }
758 QtProperty *property = m_doubleManager->addProperty(propertyName);
759 m_doubleManager->setDecimals(property, m_decimals);
760 m_doubleManager->setRange(property, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
761 this->addProperty(propertyName, property, &FitOptionsBrowser::getDoubleProperty,
763 return property;
764}
765
775void FitOptionsBrowser::displayProperty(const QString &propertyName, bool show) {
776 if (!m_propertyNameMap.contains(propertyName)) {
777 throw std::runtime_error("Property " + propertyName.toStdString() + " isn't supported by the browser.");
778 }
779 auto prop = m_propertyNameMap[propertyName];
780 if (show) {
781 m_browser->addProperty(prop);
782 } else {
783 m_browser->removeProperty(prop);
784 }
785}
786
791 if (!m_propertyNameMap.contains(name)) {
792 return false;
793 }
794 auto prop = m_propertyNameMap[name];
795 m_sequentialProperties.removeAll(prop);
796 m_simultaneousProperties.removeAll(prop);
797 m_browser->removeProperty(prop);
798 return true;
799}
800
805 foreach (QtProperty *prop, m_sequentialProperties) {
806 m_browser->addProperty(prop);
807 }
808 foreach (QtProperty *prop, m_simultaneousProperties) {
809 m_browser->removeProperty(prop);
810 }
812}
813
814} // namespace MantidQt::MantidWidgets
std::string name
Definition Run.cpp:60
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.
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.
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.
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.
QMap< QtProperty const *, SetterType > m_setters
Store for the properties setter methods.
QtProperty * m_outputWorkspace
OutputWorkspace property.
void setProperty(const QString &name, const QString &value)
Set a new value to a Fit's property.
QMap< QtProperty const *, GetterType > m_getters
Store for the properties getter methods.
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:76
const std::string & name() const
Get the property's name.
Definition Property.cpp:61
virtual std::string value() const =0
Returns the value of the property as a string.
std::string toString(const T &value)
Convert values to strings.