17#include "MantidQtWidgets/Common/QtPropertyBrowser/qtpropertymanager.h"
18#include "MantidQtWidgets/Common/QtPropertyBrowser/qttreepropertybrowser.h"
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
26#pragma GCC diagnostic ignored "-Woverloaded-virtual"
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
49 : m_values(
std::move(propertyValues)) {}
54 const QStringList &propertyNames) {
55 QMap<QString, QString> propertyValues;
56 for (
const auto &
name : propertyNames) {
57 auto const value = settings.value(
name).toString();
66 for (
auto property = snapshot.
values().constBegin();
property != snapshot.
values().constEnd(); ++property)
67 writer.
setValue(property.key(),
property.value());
76 : QWidget(parent), m_fittingTypeProp(nullptr), m_minimizer(nullptr), m_decimals(6), m_fittingType(fitType) {
81 auto *layout =
new QVBoxLayout(
this);
83 layout->setContentsMargins(0, 0, 0, 0);
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);
114 m_browser =
new QtTreePropertyBrowser(
nullptr, QStringList(),
false);
138 types <<
"Sequential"
186 std::vector<std::string> minimizerOptions = Mantid::API::FuncMinimizerFactory::Instance().getKeys();
187 QStringList minimizers;
190 for (
auto const &minimizerOption : minimizerOptions) {
191 minimizers << QString::fromStdString(minimizerOption);
206 std::vector<std::string> costOptions = Mantid::API::CostFunctionFactory::Instance().getKeys();
207 QStringList costFunctions;
209 for (
auto const &costOption : costOptions) {
210 costFunctions << QString::fromStdString(costOption);
221 QStringList evaluationTypes;
222 evaluationTypes <<
"CentrePoint"
261 types <<
"Sequential"
286 prop =
m_boolManager->addProperty(
"Output Composite Members");
301 prop =
m_boolManager->addProperty(
"Pass WS Index To Function");
379 for (QtProperty *prop : subProperties) {
387 auto minimizer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(minimizerName.toStdString());
390 auto minimizerProperties = minimizer->getProperties();
391 for (
auto const &minimizerProperty : minimizerProperties) {
431 throw std::runtime_error(
"Unable to create a QtProperty.");
433 QString propName = QString::fromStdString(property->
name());
434 QtProperty *prop =
nullptr;
453 QString val = QString::fromStdString(prp->value());
459 QMessageBox::warning(
this,
"Mantid - Error",
460 "Type of minimizer's property " + propName +
" is not yet supported by the browser.");
466 throw std::runtime_error(
"Failed to create a QtProperty.");
470 QString toolTip = QString::fromStdString(property->
documentation());
471 if (!toolTip.isEmpty()) {
472 prop->setToolTip(toolTip);
484 auto propertyName = p.key().toStdString();
486 auto prop = p.value();
499 throw std::runtime_error(
"Property " +
name.toStdString() +
" isn't supported by the browser.");
503 return (this->*f)(prop);
513 throw std::runtime_error(
"Property " +
name.toStdString() +
" isn't supported by the browser.");
517 (this->*f)(prop,
value);
528 if (subProperties.size() > 1) {
529 for (
const QtProperty *prop : subProperties) {
534 if (!
value.isEmpty()) {
535 minimStr +=
"," + prop->propertyName() +
"=" +
value;
538 minimStr +=
"," + prop->propertyName() +
"=";
546 throw std::runtime_error(
"The fit browser doesn't support the type "
547 "of minimizer's property " +
548 prop->propertyName().toStdString());
561 QStringList terms =
value.split(
',');
616 bool boolValue = (
value ==
"1") || (
value.toLower() ==
"true");
660 QMap<QString, QString> propertyValues;
662 auto prop = p.value();
664 propertyValues.insert(p.key(), (this->*f)(prop));
676 auto prop =
property.value();
678 (this->*f)(prop,
value.value());
726 if (!values.isEmpty() && values.front().isEmpty()) {
729 QStringList names = values;
733 if (i < values.size()) {
777 throw std::runtime_error(
"Property " + propertyName.toStdString() +
" already added.");
781 m_doubleManager->setRange(property, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
798 throw std::runtime_error(
"Property " + propertyName.toStdString() +
" isn't supported by the browser.");
double value
The value of the point.
IAlgorithm is the interface implemented by the Algorithm base class.
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.
const std::string & documentation() const
Get the property's documentation string.
const std::string & name() const
Get the property's name.
virtual std::string value() const =0
Returns the value of the property as a string.