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 +
9
16
17#include "MantidQtWidgets/Common/QtPropertyBrowser/qtpropertymanager.h"
18#include "MantidQtWidgets/Common/QtPropertyBrowser/qttreepropertybrowser.h"
19// Suppress a warning coming out of code that isn't ours
20#if defined(__INTEL_COMPILER)
21#pragma warning disable 1125
22#elif defined(__GNUC__)
23#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
24#pragma GCC diagnostic push
25#endif
26#pragma GCC diagnostic ignored "-Woverloaded-virtual"
27#endif
28#include "MantidQtWidgets/Common/QtPropertyBrowser/ButtonEditorFactory.h"
29#include "MantidQtWidgets/Common/QtPropertyBrowser/CompositeEditorFactory.h"
30#include "MantidQtWidgets/Common/QtPropertyBrowser/DoubleEditorFactory.h"
31#include "MantidQtWidgets/Common/QtPropertyBrowser/qteditorfactory.h"
32#if defined(__INTEL_COMPILER)
33#pragma warning enable 1125
34#elif defined(__GNUC__)
35#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
36#pragma GCC diagnostic pop
37#endif
38#endif
39
40#include <QMessageBox>
41#include <QSettings>
42#include <QVBoxLayout>
43#include <limits>
44#include <utility>
45
47
48FitOptionsBrowserSettings::FitOptionsBrowserSettings(QMap<QString, QString> propertyValues)
49 : m_values(std::move(propertyValues)) {}
50
51const QMap<QString, QString> &FitOptionsBrowserSettings::values() const { return m_values; }
52
54 const QStringList &propertyNames) {
55 QMap<QString, QString> propertyValues;
56 for (const auto &name : propertyNames) {
57 auto const value = settings.value(name).toString();
58 if (!value.isEmpty())
59 propertyValues.insert(name, value);
60 }
61 return FitOptionsBrowserSettings(std::move(propertyValues));
62}
63
64void FitOptionsBrowserSettings::saveSettings(QSettings &settings, const FitOptionsBrowserSettings &snapshot) {
65 QSettingsChangeAware writer(settings);
66 for (auto property = snapshot.values().constBegin(); property != snapshot.values().constEnd(); ++property)
67 writer.setValue(property.key(), property.value());
68}
69
76 : QWidget(parent), m_fittingTypeProp(nullptr), m_minimizer(nullptr), m_decimals(6), m_fittingType(fitType) {
77 // create m_browser
80
81 auto *layout = new QVBoxLayout(this);
82 layout->addWidget(m_browser);
83 layout->setContentsMargins(0, 0, 0, 0);
84}
85
87 m_browser->unsetFactoryForManager(m_stringManager);
88 m_browser->unsetFactoryForManager(m_doubleManager);
89 m_browser->unsetFactoryForManager(m_intManager);
90 m_browser->unsetFactoryForManager(m_boolManager);
91 m_browser->unsetFactoryForManager(m_enumManager);
92}
93
98 /* Create property managers: they create, own properties, get and set values
99 */
100 m_stringManager = new QtStringPropertyManager(this);
101 m_doubleManager = new QtDoublePropertyManager(this);
102 m_intManager = new QtIntPropertyManager(this);
103 m_boolManager = new QtBoolPropertyManager(this);
104 m_enumManager = new QtEnumPropertyManager(this);
105 m_groupManager = new QtGroupPropertyManager(this);
106
107 // create editor factories
108 auto *spinBoxFactory = new QtSpinBoxFactory(this);
109 auto *doubleEditorFactory = new DoubleEditorFactory(this);
110 auto *lineEditFactory = new QtLineEditFactory(this);
111 auto *checkBoxFactory = new QtCheckBoxFactory(this);
112 auto *comboBoxFactory = new QtEnumEditorFactory(this);
113
114 m_browser = new QtTreePropertyBrowser(nullptr, QStringList(), false);
115 // assign factories to property managers
116 m_browser->setFactoryForManager(m_stringManager, lineEditFactory);
117 m_browser->setFactoryForManager(m_doubleManager, doubleEditorFactory);
118 m_browser->setFactoryForManager(m_intManager, spinBoxFactory);
119 m_browser->setFactoryForManager(m_boolManager, checkBoxFactory);
120 m_browser->setFactoryForManager(m_enumManager, comboBoxFactory);
121
122 // m_browser->setContextMenuPolicy(Qt::CustomContextMenu);
123 // connect(m_browser, SIGNAL(customContextMenuRequested(const QPoint &)),
124 // this, SLOT(popupMenu(const QPoint &)));
125
126 connect(m_enumManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(enumChanged(QtProperty *)));
127 connect(m_doubleManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(doubleChanged(QtProperty *)));
128 // Fill in getter and setter maps
129}
130
136 m_fittingTypeProp = m_enumManager->addProperty("Fitting");
137 QStringList types;
138 types << "Sequential"
139 << "Simultaneous";
140 m_enumManager->setEnumNames(m_fittingTypeProp, types);
142 m_browser->addProperty(m_fittingTypeProp);
145 }
146}
147
162
164 // Create MaxIterations property
165 m_maxIterations = m_intManager->addProperty("Max Iterations");
166 {
167 m_intManager->setValue(m_maxIterations, 500);
168 m_intManager->setMinimum(m_maxIterations, 0);
169 m_browser->addProperty(m_maxIterations);
170
173 }
174
175 // Set up the minimizer property.
176 //
177 // Create the enclosing group property. This group contains
178 // the minimizer name plus any properties of its own
179 m_minimizerGroup = m_groupManager->addProperty("Minimizer");
180 {
181 // Add the name property to the group
182 m_minimizer = m_enumManager->addProperty("Name");
183 m_minimizerGroup->addSubProperty(m_minimizer);
184
185 // Get names of registered minimizers from the factory
186 std::vector<std::string> minimizerOptions = Mantid::API::FuncMinimizerFactory::Instance().getKeys();
187 QStringList minimizers;
188
189 // Store them in the m_minimizer enum property
190 for (auto const &minimizerOption : minimizerOptions) {
191 minimizers << QString::fromStdString(minimizerOption);
192 }
193 m_enumManager->setEnumNames(m_minimizer, minimizers);
194 int i = static_cast<int>(m_enumManager->enumNames(m_minimizer).indexOf("Levenberg-Marquardt"));
195 if (i >= 0) {
196 m_enumManager->setValue(m_minimizer, i);
197 }
198 m_browser->addProperty(m_minimizerGroup);
200 }
201
202 // Create cost function property
203 m_costFunction = m_enumManager->addProperty("Cost Function");
204 {
205 // Get names of registered cost functions from the factory
206 std::vector<std::string> costOptions = Mantid::API::CostFunctionFactory::Instance().getKeys();
207 QStringList costFunctions;
208 // Store them in the m_minimizer enum property
209 for (auto const &costOption : costOptions) {
210 costFunctions << QString::fromStdString(costOption);
211 }
212 m_enumManager->setEnumNames(m_costFunction, costFunctions);
213 m_browser->addProperty(m_costFunction);
216 }
217
218 // Create EvaluationType property
219 m_evaluationType = m_enumManager->addProperty("Evaluate Function As");
220 {
221 QStringList evaluationTypes;
222 evaluationTypes << "CentrePoint"
223 << "Histogram";
224 m_enumManager->setEnumNames(m_evaluationType, evaluationTypes);
225 m_browser->addProperty(m_evaluationType);
228 }
229 // Create PeakRadius property
230 m_peakRadius = m_intManager->addProperty("Peak Radius");
231 {
232 m_intManager->setValue(m_peakRadius, 0);
233 m_intManager->setMinimum(m_peakRadius, 0);
234 m_browser->addProperty(m_peakRadius);
236 }
237
238 m_ignoreInvalidData = m_boolManager->addProperty("Ignore Invalid Data");
239 {
240 m_browser->addProperty(m_ignoreInvalidData);
243 }
244}
245
255
257 // Create FitType property, a property of algorithm PlotPeakByLogValue
258 m_plotPeakByLogValueFitType = m_enumManager->addProperty("Fit Type");
259 {
260 QStringList types;
261 types << "Sequential"
262 << "Individual";
263 m_enumManager->setEnumNames(m_plotPeakByLogValueFitType, types);
268 }
269
270 // Create OutputWorkspace property
271 m_outputWorkspace = m_stringManager->addProperty("OutputWorkspace");
272 {
276 }
277
278 // Create CreateOutput property
279 auto prop = m_boolManager->addProperty("Create Output");
280 {
283 }
284
285 // Create OutputCompositeMembers property
286 prop = m_boolManager->addProperty("Output Composite Members");
287 {
288 addProperty("OutputCompositeMembers", prop, &FitOptionsBrowser::getBoolProperty,
291 }
292
293 // Create ConvolveMembers property
294 prop = m_boolManager->addProperty("Convolve Members");
295 {
298 }
299
300 // Create PassWSIndexToFunction property
301 prop = m_boolManager->addProperty("Pass WS Index To Function");
302 {
303 addProperty("PassWSIndexToFunction", prop, &FitOptionsBrowser::getBoolProperty,
306 }
307
308 // Create LogValue property
309 m_logValue = m_enumManager->addProperty("Log Value");
310 {
311 // m_enumManager->setValue(m_logValue,0);
315 }
316
317 // Create LogValue property
318 m_plotParameter = m_enumManager->addProperty("Plot parameter");
319 {
323 }
324}
325
326void FitOptionsBrowser::addProperty(const QString &name, QtProperty *prop,
327 QString (FitOptionsBrowser::*getter)(QtProperty *) const,
328 void (FitOptionsBrowser::*setter)(QtProperty *, const QString &)) {
329 m_propertyNameMap[name] = prop;
330 m_getters[prop] = getter;
331 m_setters[prop] = setter;
332}
333
340 if (m_propertyNameMap.contains(name)) {
341 auto const *prop = m_propertyNameMap[name];
342 m_getters.remove(prop);
343 m_setters.remove(prop);
344 m_propertyNameMap.remove(name);
345 }
346}
347
348/* *********************
349 * ** Private Slots **
350 * *********************/
351
356void FitOptionsBrowser::enumChanged(QtProperty *prop) {
357 if (prop == m_minimizer) {
359 } else if (prop == m_fittingTypeProp) {
361 }
362}
363
367void FitOptionsBrowser::doubleChanged(QtProperty *property) { emit doublePropertyChanged(property->propertyName()); }
368
373 int i = m_enumManager->value(m_minimizer);
374 QString minimizerName = m_enumManager->enumNames(m_minimizer)[i];
375 m_minimizerGroup->setPropertyName("Minimizer " + minimizerName);
376
377 // Remove properties of the old minimizer
378 auto subProperties = m_minimizerGroup->subProperties();
379 for (QtProperty *prop : subProperties) {
380 if (prop != m_minimizer) {
381 m_minimizerGroup->removeSubProperty(prop);
382 removeProperty(prop->propertyName());
383 }
384 }
385
386 // Check if the new minimizer has its own properties
387 auto minimizer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(minimizerName.toStdString());
388
389 // Create and add properties to the minimizer group
390 auto minimizerProperties = minimizer->getProperties();
391 for (auto const &minimizerProperty : minimizerProperties) {
392 auto prop = createPropertyProperty(minimizerProperty);
393 if (prop) {
394 m_minimizerGroup->addSubProperty(prop);
395 }
396 }
397}
398
403 const auto fittingMode = getCurrentFittingType();
404 if (fittingMode == FittingMode::SIMULTANEOUS) {
406 } else {
408 }
409}
410
415 for (QtProperty *prop : m_simultaneousProperties) {
416 m_browser->addProperty(prop);
417 }
418 for (QtProperty *prop : m_sequentialProperties) {
419 m_browser->removeProperty(prop);
420 }
422}
423
430 if (!property) {
431 throw std::runtime_error("Unable to create a QtProperty.");
432 }
433 QString propName = QString::fromStdString(property->name());
434 QtProperty *prop = nullptr;
435 if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<bool> const *>(property)) {
436 prop = m_boolManager->addProperty(propName);
437 bool val = *prp;
438 m_boolManager->setValue(prop, val);
439 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<double> const *>(property)) {
440 prop = this->addDoubleProperty(propName);
441 double val = *prp;
442 m_doubleManager->setValue(prop, val);
443 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<int> const *>(property)) {
444 prop = m_intManager->addProperty(propName);
445 int val = *prp;
446 m_intManager->setValue(prop, val);
447 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<size_t> const *>(property)) {
448 prop = m_intManager->addProperty(propName);
449 size_t val = *prp;
450 m_intManager->setValue(prop, static_cast<int>(val));
451 } else if (auto const *prp = dynamic_cast<Mantid::Kernel::PropertyWithValue<std::string> const *>(property)) {
452 prop = m_stringManager->addProperty(propName);
453 QString val = QString::fromStdString(prp->value());
454 m_stringManager->setValue(prop, val);
455 } else if (dynamic_cast<Mantid::API::IWorkspaceProperty const *>(property)) {
456 prop = m_stringManager->addProperty(propName);
457 m_stringManager->setValue(prop, QString::fromStdString(property->value()));
458 } else {
459 QMessageBox::warning(this, "Mantid - Error",
460 "Type of minimizer's property " + propName + " is not yet supported by the browser.");
461 return nullptr;
462 }
463
464 // Something bad happened in QtPropertyBrowser.
465 if (!prop) {
466 throw std::runtime_error("Failed to create a QtProperty.");
467 }
468
469 // set the tooltip from property doc string
470 QString toolTip = QString::fromStdString(property->documentation());
471 if (!toolTip.isEmpty()) {
472 prop->setToolTip(toolTip);
473 }
474
475 return prop;
476}
477
483 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
484 auto propertyName = p.key().toStdString();
485 if (fit.existsProperty(propertyName)) {
486 auto prop = p.value();
487 auto f = m_getters[prop];
488 fit.setPropertyValue(propertyName, (this->*f)(prop).toStdString());
489 }
490 }
491}
492
497QString FitOptionsBrowser::getProperty(const QString &name) const {
498 if (!m_propertyNameMap.contains(name)) {
499 throw std::runtime_error("Property " + name.toStdString() + " isn't supported by the browser.");
500 }
501 auto prop = m_propertyNameMap[name];
502 auto f = m_getters[prop];
503 return (this->*f)(prop);
504}
505
511void FitOptionsBrowser::setProperty(const QString &name, const QString &value) {
512 if (!m_propertyNameMap.contains(name)) {
513 throw std::runtime_error("Property " + name.toStdString() + " isn't supported by the browser.");
514 }
515 auto prop = m_propertyNameMap[name];
516 auto f = m_setters[prop];
517 (this->*f)(prop, value);
518}
519
523QString FitOptionsBrowser::getMinimizer(QtProperty * /*unused*/) const {
524 int i = m_enumManager->value(m_minimizer);
525 QString minimStr = m_enumManager->enumNames(m_minimizer)[i];
526
527 auto subProperties = m_minimizerGroup->subProperties();
528 if (subProperties.size() > 1) {
529 for (const QtProperty *prop : subProperties) {
530 if (prop == m_minimizer)
531 continue;
532 if (prop->propertyManager() == m_stringManager) {
533 QString value = m_stringManager->value(prop);
534 if (!value.isEmpty()) {
535 minimStr += "," + prop->propertyName() + "=" + value;
536 }
537 } else {
538 minimStr += "," + prop->propertyName() + "=";
539 if (prop->propertyManager() == m_intManager) {
540 minimStr += QString::number(m_intManager->value(prop));
541 } else if (prop->propertyManager() == m_doubleManager) {
542 minimStr += QString::number(m_doubleManager->value(prop));
543 } else if (prop->propertyManager() == m_boolManager) {
544 minimStr += QString::number(m_boolManager->value(prop));
545 } else {
546 throw std::runtime_error("The fit browser doesn't support the type "
547 "of minimizer's property " +
548 prop->propertyName().toStdString());
549 }
550 }
551 } // for
552 }
553 return minimStr;
554}
555
560void FitOptionsBrowser::setMinimizer(QtProperty * /*unused*/, const QString &value) {
561 QStringList terms = value.split(',');
562 int i = static_cast<int>(m_enumManager->enumNames(m_minimizer).indexOf(terms[0]));
563 m_enumManager->setValue(m_minimizer, i);
564}
565
566// ------------------------- Generic setters and getters
567// ------------------------------//
568
573QString FitOptionsBrowser::getIntProperty(QtProperty *prop) const { return QString::number(m_intManager->value(prop)); }
574
580void FitOptionsBrowser::setIntProperty(QtProperty *prop, const QString &value) {
581 m_intManager->setValue(prop, value.toInt());
582}
583
589QString FitOptionsBrowser::getDoubleProperty(QtProperty *prop) const {
590 return QString::number(m_doubleManager->value(prop));
591}
592
598void FitOptionsBrowser::setDoubleProperty(QtProperty *prop, const QString &value) {
599 m_doubleManager->setValue(prop, value.toDouble());
600}
601
606QString FitOptionsBrowser::getBoolProperty(QtProperty *prop) const {
607 return QString::number(m_boolManager->value(prop));
608}
609
615void FitOptionsBrowser::setBoolProperty(QtProperty *prop, const QString &value) {
616 bool boolValue = (value == "1") || (value.toLower() == "true");
617 m_boolManager->setValue(prop, boolValue);
618}
619
624QString FitOptionsBrowser::getStringEnumProperty(QtProperty *prop) const {
625 int i = m_enumManager->value(prop);
626 if (i < 0)
627 return "";
628 return m_enumManager->enumNames(prop)[i];
629}
630
636void FitOptionsBrowser::setStringEnumProperty(QtProperty *prop, const QString &value) {
637 int i = static_cast<int>(m_enumManager->enumNames(prop).indexOf(value));
638 if (i >= 0)
639 m_enumManager->setValue(prop, i);
640}
641
646QString FitOptionsBrowser::getStringProperty(QtProperty *prop) const { return m_stringManager->value(prop); }
647
653void FitOptionsBrowser::setStringProperty(QtProperty *prop, const QString &value) {
654 m_stringManager->setValue(prop, value);
655}
656
657// ------------------------------------------------------------------------------------//
658
660 QMap<QString, QString> propertyValues;
661 for (auto p = m_propertyNameMap.constBegin(); p != m_propertyNameMap.constEnd(); ++p) {
662 auto prop = p.value();
663 auto f = m_getters[prop];
664 propertyValues.insert(p.key(), (this->*f)(prop));
665 }
666 return FitOptionsBrowserSettings(std::move(propertyValues));
667}
668
672
674 for (auto value = settings.values().constBegin(); value != settings.values().constEnd(); ++value) {
675 if (auto property = m_propertyNameMap.find(value.key()); property != m_propertyNameMap.end()) {
676 auto prop = property.value();
677 auto f = m_setters[prop];
678 (this->*f)(prop, value.value());
679 }
680 }
681}
682
691
697 if (fitType == FittingMode::SIMULTANEOUS) {
698 m_enumManager->setValue(m_fittingTypeProp, 1);
699 } else {
700 m_enumManager->setValue(m_fittingTypeProp, 0);
701 }
702}
703
710 setCurrentFittingType(fitType);
711 m_fittingTypeProp->setEnabled(false);
712}
713
718
724void FitOptionsBrowser::setPropertyEnumValues(QtProperty *prop, const QStringList &values) {
725 auto i = m_enumManager->value(prop);
726 if (!values.isEmpty() && values.front().isEmpty()) {
727 m_enumManager->setEnumNames(prop, values);
728 } else {
729 QStringList names = values;
730 names.insert(0, "");
731 m_enumManager->setEnumNames(prop, names);
732 }
733 if (i < values.size()) {
734 m_enumManager->setValue(prop, i);
735 } else {
736 m_enumManager->setValue(prop, 0);
737 }
738}
739
744void FitOptionsBrowser::setLogNames(const QStringList &logNames) { setPropertyEnumValues(m_logValue, logNames); }
745
749void FitOptionsBrowser::setParameterNamesForPlotting(const QStringList &parNames) {
751}
752
758 auto i = m_enumManager->value(m_plotParameter);
759 if (i < 0)
760 i = 0;
761 return m_enumManager->enumNames(m_plotParameter)[i];
762}
763
764/* *************************
765 * ** Protected Members **
766 * *************************/
767
775QtProperty *FitOptionsBrowser::addDoubleProperty(const QString &propertyName) {
776 if (m_propertyNameMap.contains(propertyName)) {
777 throw std::runtime_error("Property " + propertyName.toStdString() + " already added.");
778 }
779 QtProperty *property = m_doubleManager->addProperty(propertyName);
780 m_doubleManager->setDecimals(property, m_decimals);
781 m_doubleManager->setRange(property, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
782 this->addProperty(propertyName, property, &FitOptionsBrowser::getDoubleProperty,
784 return property;
785}
786
796void FitOptionsBrowser::displayProperty(const QString &propertyName, bool show) {
797 if (!m_propertyNameMap.contains(propertyName)) {
798 throw std::runtime_error("Property " + propertyName.toStdString() + " isn't supported by the browser.");
799 }
800 auto prop = m_propertyNameMap[propertyName];
801 if (show) {
802 m_browser->addProperty(prop);
803 } else {
804 m_browser->removeProperty(prop);
805 }
806}
807
812 if (!m_propertyNameMap.contains(name)) {
813 return false;
814 }
815 auto prop = m_propertyNameMap[name];
816 m_sequentialProperties.removeAll(prop);
817 m_simultaneousProperties.removeAll(prop);
818 m_browser->removeProperty(prop);
819 return true;
820}
821
826 for (QtProperty *prop : m_sequentialProperties) {
827 m_browser->addProperty(prop);
828 }
829 for (QtProperty *prop : m_simultaneousProperties) {
830 m_browser->removeProperty(prop);
831 }
833}
834
835} // namespace MantidQt::MantidWidgets
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
FitOptionsBrowserSettings(QMap< QString, QString > propertyValues={})
static FitOptionsBrowserSettings readSettings(const QSettings &settings, const QStringList &propertyNames)
Query supplied property names without changing widgets or writing settings.
const QMap< QString, QString > & values() const
static void saveSettings(QSettings &settings, const FitOptionsBrowserSettings &snapshot)
Persist only the property values contained in a snapshot.
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.
FitOptionsBrowserSettings readSettings(const QSettings &settings) const
Query persistent storage without changing browser state.
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 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...
FitOptionsBrowserSettings captureSettings() const
Capture current browser state without persistent access.
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.
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 restoreSettings(const FitOptionsBrowserSettings &settings)
Apply an immutable settings snapshot without persistent access.
void removeProperty(const QString &name)
Remove a property previously added with addProperty (If property doesn't exist, does nothing).
QtProperty * m_costFunction
CostFunction property.
A QSettings facade that applies only effective changes.
bool setValue(QString const &key, QVariant const &value)
Set a value only when the effective stored value differs.
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:78
const std::string & name() const
Get the property's name.
Definition Property.cpp:63
virtual std::string value() const =0
Returns the value of the property as a string.
STL namespace.