16#include "MantidQtWidgets/Common/QtPropertyBrowser/qtpropertymanager.h"
17#include "MantidQtWidgets/Common/QtPropertyBrowser/qttreepropertybrowser.h"
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
25#pragma GCC diagnostic ignored "-Woverloaded-virtual"
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
52 : QWidget(parent), m_fittingTypeProp(nullptr), m_minimizer(nullptr), m_decimals(6), m_fittingType(fitType) {
57 auto *layout =
new QVBoxLayout(
this);
59 layout->setContentsMargins(0, 0, 0, 0);
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);
90 m_browser =
new QtTreePropertyBrowser(
nullptr, QStringList(),
false);
114 types <<
"Sequential"
162 std::vector<std::string> minimizerOptions = Mantid::API::FuncMinimizerFactory::Instance().getKeys();
163 QStringList minimizers;
166 for (
auto const &minimizerOption : minimizerOptions) {
167 minimizers << QString::fromStdString(minimizerOption);
182 std::vector<std::string> costOptions = Mantid::API::CostFunctionFactory::Instance().getKeys();
183 QStringList costFunctions;
185 for (
auto const &costOption : costOptions) {
186 costFunctions << QString::fromStdString(costOption);
197 QStringList evaluationTypes;
198 evaluationTypes <<
"CentrePoint"
237 types <<
"Sequential"
262 prop =
m_boolManager->addProperty(
"Output Composite Members");
277 prop =
m_boolManager->addProperty(
"Pass WS Index To Function");
355 foreach (QtProperty *prop, subProperties) {
363 auto minimizer = Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(minimizerName.toStdString());
366 auto minimizerProperties = minimizer->getProperties();
367 for (
auto const &minimizerProperty : minimizerProperties) {
407 throw std::runtime_error(
"Unable to create a QtProperty.");
409 QString propName = QString::fromStdString(property->
name());
410 QtProperty *prop =
nullptr;
429 QString val = QString::fromStdString(prp->value());
435 QMessageBox::warning(
this,
"Mantid - Error",
436 "Type of minimizer's property " + propName +
" is not yet supported by the browser.");
442 throw std::runtime_error(
"Failed to create a QtProperty.");
446 QString toolTip = QString::fromStdString(property->
documentation());
447 if (!toolTip.isEmpty()) {
448 prop->setToolTip(toolTip);
460 auto propertyName = p.key().toStdString();
462 auto prop = p.value();
475 throw std::runtime_error(
"Property " +
name.toStdString() +
" isn't supported by the browser.");
479 return (this->*f)(prop);
489 throw std::runtime_error(
"Property " +
name.toStdString() +
" isn't supported by the browser.");
493 (this->*f)(prop,
value);
504 if (subProperties.size() > 1) {
505 foreach (
const QtProperty *prop, subProperties) {
510 if (!
value.isEmpty()) {
511 minimStr +=
"," + prop->propertyName() +
"=" +
value;
514 minimStr +=
"," + prop->propertyName() +
"=";
522 throw std::runtime_error(
"The fit browser doesn't support the type "
523 "of minimizer's property " +
524 prop->propertyName().toStdString());
537 QStringList terms =
value.split(
',');
592 bool boolValue = (
value ==
"1") || (
value.toLower() ==
"true");
641 auto prop = p.value();
643 settings.setValue(p.key(), (this->*f)(prop));
654 if (!
value.isEmpty()) {
655 auto prop = p.value();
657 (this->*f)(prop,
value);
705 if (!values.isEmpty() && values.front().isEmpty()) {
708 QStringList names = values;
712 if (i < values.size()) {
756 throw std::runtime_error(
"Property " + propertyName.toStdString() +
" already added.");
760 m_doubleManager->setRange(property, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
777 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.
std::string toString(const T &value)
Convert values to strings.