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"
163 QStringList minimizers;
166 for (
auto &minimizerOption : minimizerOptions) {
167 minimizers << QString::fromStdString(minimizerOption);
183 QStringList costFunctions;
185 for (
auto &costOption : costOptions) {
186 costFunctions << QString::fromStdString(costOption);
197 QStringList evaluationTypes;
198 evaluationTypes <<
"CentrePoint"
239 types <<
"Sequential"
264 prop =
m_boolManager->addProperty(
"Output Composite Members");
279 prop =
m_boolManager->addProperty(
"Pass WS Index To Function");
357 foreach (QtProperty *prop, subProperties) {
368 auto minimizerProperties = minimizer->getProperties();
369 for (
auto &minimizerProperty : minimizerProperties) {
405 throw std::runtime_error(
"Unable to create a QtProperty.");
407 QString propName = QString::fromStdString(property->
name());
408 QtProperty *prop =
nullptr;
427 QString val = QString::fromStdString(prp->value());
433 QMessageBox::warning(
this,
"Mantid - Error",
434 "Type of minimizer's property " + propName +
" is not yet supported by the browser.");
440 throw std::runtime_error(
"Failed to create a QtProperty.");
444 QString toolTip = QString::fromStdString(property->
documentation());
445 if (!toolTip.isEmpty()) {
446 prop->setToolTip(toolTip);
458 auto propertyName = p.key().toStdString();
460 auto prop = p.value();
473 throw std::runtime_error(
"Property " + name.toStdString() +
" isn't supported by the browser.");
477 return (this->*f)(prop);
487 throw std::runtime_error(
"Property " + name.toStdString() +
" isn't supported by the browser.");
491 (this->*f)(prop,
value);
502 if (subProperties.size() > 1) {
503 foreach (QtProperty *prop, subProperties) {
508 if (!
value.isEmpty()) {
509 minimStr +=
"," + prop->propertyName() +
"=" +
value;
512 minimStr +=
"," + prop->propertyName() +
"=";
520 throw std::runtime_error(
"The fit browser doesn't support the type "
521 "of minimizer's property " +
522 prop->propertyName().toStdString());
535 QStringList terms =
value.split(
',');
590 bool boolValue = (
value ==
"1") || (
value.toLower() ==
"true");
639 auto prop = p.value();
641 settings.setValue(p.key(), (this->*f)(prop));
651 QString
value = settings.value(p.key()).toString();
652 if (!
value.isEmpty()) {
653 auto prop = p.value();
655 (this->*f)(prop,
value);
703 if (!values.isEmpty() && values.front().isEmpty()) {
706 QStringList names = values;
710 if (i < values.size()) {
754 throw std::runtime_error(
"Property " + propertyName.toStdString() +
" already added.");
758 m_doubleManager->setRange(property, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
775 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.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...