Mantid
Loading...
Searching...
No Matches
AlgorithmPropertiesWidget.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 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 +
7#pragma once
8
9#include "DllOption.h"
13#include <QWidget>
14
15class QGridLayout;
16class QGroupBox;
17class QScrollArea;
18
19namespace Mantid {
20namespace Kernel {
21class Property;
22}
23} // namespace Mantid
24
25namespace MantidQt {
26namespace API {
27class PropertyWidget;
28
36 Q_OBJECT
37 Q_PROPERTY(QString algorithmName READ getAlgorithmName WRITE setAlgorithmName)
38
39public:
40 AlgorithmPropertiesWidget(QWidget *parent = nullptr);
42
43 void setInputHistory(MantidQt::API::AbstractAlgorithmInputHistory *inputHistory);
44
45 void initLayout();
46
47 Mantid::API::IAlgorithm_sptr getAlgorithm();
48 void setAlgorithm(const Mantid::API::IAlgorithm_sptr &algo);
49
50 const QString &getAlgorithmName() const;
51 void setAlgorithmName(QString name);
52
53 void addEnabledAndDisableLists(const QStringList &enabled, const QStringList &disabled);
54
55 void shareErrorsMap(const QHash<QString, QString> &errors);
56
57 void hideOrDisableProperties(const QString &changedPropName = "");
58
59 void saveInput();
60
63
66
68 QWidget *m_viewport;
69
71 QScrollArea *m_scroll;
72
73public slots:
75 void propertyChanged(const QString &changedPropName);
76
78 void replaceWSClicked(const QString &propName);
79
80protected:
81 // These methods are `protected` rather than `private` to facilitate unit testing:
82 // they should really not be used outside of this dialog class.
83 // For the external methods, see `IPropertyManager::isPropertyEnabled` and
84 // `IPropertyManager::isPropertyVisible`.
85 bool isWidgetEnabled(const Mantid::Kernel::Property *prop) const;
86
87 bool isWidgetVisible(const Mantid::Kernel::Property *prop) const;
88
89private:
91 bool hasInputWS(const std::vector<Mantid::Kernel::Property *> &prop_list) const;
92
94 QString m_algoName;
95
98
100 QGridLayout *m_inputGrid;
101
103 QGridLayout *m_currentGrid;
104
107 // The current widget is no longer responsible for setting property values, so this map points
108 // to the corresponding map from the parent dialog.
110
112 QStringList m_enabled;
113
116 QStringList m_disabled;
117
120};
121
122} // namespace API
123} // namespace MantidQt
std::string name
Definition Run.cpp:60
#define EXPORT_OPT_MANTIDQT_COMMON
Definition DllOption.h:15
This abstract class deals with the loading and saving of previous algorithm property values to/from M...
Widget that contains dynamically generated PropertyWidget's for each property of an algorithm,...
QScrollArea * m_scroll
Scroll area containing the viewport.
MantidQt::API::AbstractAlgorithmInputHistory * m_inputHistory
History of inputs to the algorithm.
Mantid::API::IAlgorithm_sptr m_algo
Pointer to the algorithm to view.
QStringList m_enabled
A list of property names that are FORCED to stay enabled.
QGridLayout * m_inputGrid
The grid widget containing the input boxes.
QWidget * m_viewport
Viewport containing the grid of property widgets.
QHash< QString, QGroupBox * > m_groupWidgets
Mapping between group and it's dynamically created widget.
QHash< QString, QString > const * m_errors
A map where key = property name; value = any error for this property (i.e.
QHash< QString, PropertyWidget * > m_propWidgets
Each dynamically created PropertyWidget.
QStringList m_disabled
A list of property names that are FORCED to stay disabled.
QGridLayout * m_currentGrid
The current grid widget for sub-boxes.
~AlgorithmPropertiesWidget() override
Destructor.
Base class for properties.
Definition Property.h:94
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
Helper class which provides the Collimation Length for SANS instruments.