Mantid
Loading...
Searching...
No Matches
FitDialog.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 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//------------------------------------------------------------------------------
10// Includes
11//------------------------------------------------------------------------------
13#include "ui_FitDialog.h"
14
15#include <QSpinBox>
16
17//------------------------------------------------------------------------------
18// Qt Forward declarations
19//------------------------------------------------------------------------------
20class QVBoxLayout;
21
22namespace MantidQt {
23//------------------------------------------------------------------------------
24// Mantid Forward declarations
25//------------------------------------------------------------------------------
26namespace MantidWidgets {
27class FileFinderWidget;
28}
29
30namespace CustomDialogs {
31
32//------------------------------------------------------------------------------
33// Local Forward declarations
34//------------------------------------------------------------------------------
35class InputWorkspaceWidget;
36class DynamicPropertiesWidget;
37
54class FitDialog final : public API::AlgorithmDialog {
55 Q_OBJECT
56
57public:
59 FitDialog(QWidget *parent = nullptr);
60
61private slots:
63 // void helpClicked();
64 void workspaceChanged(const QString & /*unused*/);
65 void functionChanged();
68 void domainTypeChanged();
69
70private:
72 void initLayout() override;
74 void saveInput() override;
75 void parseInput() override;
77 void tieStaticWidgets(const bool readHistory);
79 int getDomainType() const;
81 QString getDomainTypeString() const;
82
84 QStringList getAllowedPropertyValues(const QString &propName) const;
86 void setWorkspaceName(int i, const QString &wsName);
87
89 bool isMD() const;
90
91private:
93 Ui::FitDialog m_form;
95
97};
98
102class InputWorkspaceWidget : public QWidget {
103 Q_OBJECT
104public:
106 InputWorkspaceWidget(FitDialog *parent, int domainIndex = 0);
108 QString getStoredPropertyValue(const QString &propName) const { return m_fitDialog->getPreviousValue(propName); }
110 QStringList getAllowedPropertyValues(const QString &propName) const {
111 return m_fitDialog->getAllowedPropertyValues(propName);
112 }
114 QString getWorkspaceName() const;
116 void setWorkspaceName(const QString &wsName);
118 int getDomainIndex() const { return m_domainIndex; }
120 void setPropertyValue(const QString &propName, const QString &propValue);
122 void setProperties();
124 int getDomainType() const { return m_fitDialog->getDomainType(); }
125protected slots:
128
129protected:
131 bool isWSNameSet() const;
133 bool isMatrixWorkspace() const;
135 bool isMDWorkspace() const;
137 bool isWorkspaceSupported() const;
138
147 QComboBox *m_workspaceName;
150
152 QVBoxLayout *m_layout;
153};
154
158class DynamicPropertiesWidget : public QWidget {
159public:
161 DynamicPropertiesWidget(InputWorkspaceWidget *parent) : QWidget(parent), m_wsWidget(parent) {}
163 virtual void init() = 0;
165 virtual void setProperties() = 0;
166
167protected:
170};
171
176public:
179 void init() override;
181 void setProperties() override;
182
183protected:
185 QLineEdit *m_startX;
186 QLineEdit *m_endX;
187 QSpinBox *m_maxSize;
188};
189
194public:
197 void init() override {}
199 void setProperties() override;
200
201protected:
202 QSpinBox *m_maxSize;
203};
204} // namespace CustomDialogs
205} // namespace MantidQt
This class should be the basis for all customised algorithm dialogs.
QString getPreviousValue(const QString &propName) const
Get the property value from either the previous input store or from Python argument.
Base class for input workspace's dynamic properties widget.
Definition: FitDialog.h:158
InputWorkspaceWidget * m_wsWidget
Parent InputWorkspaceWidget.
Definition: FitDialog.h:169
DynamicPropertiesWidget(InputWorkspaceWidget *parent)
Constructor.
Definition: FitDialog.h:161
virtual void setProperties()=0
Set all workspace properties.
virtual void init()=0
Initialize the child widgets with stored and allowed values.
This class gives specialised dialog for the Load algorithm.
Definition: FitDialog.h:54
void initLayout() override
Initialize the layout.
Definition: FitDialog.cpp:304
QString getDomainTypeString() const
Get the domain type: Simple, Sequential, or Parallel.
Definition: FitDialog.cpp:525
void setWorkspaceName(int i, const QString &wsName)
Set i-th workspace name.
Definition: FitDialog.cpp:453
bool isMD() const
Is the function MD?
Definition: FitDialog.cpp:503
void parseInput() override
Parse input.
Definition: FitDialog.cpp:326
void workspaceChanged(const QString &)
Override the help button clicked method.
Definition: FitDialog.cpp:461
void saveInput() override
Save the input history.
Definition: FitDialog.cpp:314
int getDomainType() const
Get the domain type: Simple, Sequential, or Parallel.
Definition: FitDialog.cpp:511
void domainTypeChanged()
Update user interface when domain type changes.
Definition: FitDialog.cpp:390
void createInputWorkspaceWidgets()
Create InputWorkspaceWidgets and populate the tabs of the tab widget.
Definition: FitDialog.cpp:409
QStringList getAllowedPropertyValues(const QString &propName) const
Get allowed values for a property.
Definition: FitDialog.cpp:473
void tieStaticWidgets(const bool readHistory)
Tie static widgets to their properties.
Definition: FitDialog.cpp:350
Widget for inputting workspace information.
Definition: FitDialog.h:102
bool isMatrixWorkspace() const
Is the workspace MW?
Definition: FitDialog.cpp:74
bool isWorkspaceSupported() const
is current workspace supported by Fit?
Definition: FitDialog.cpp:104
int getDomainType() const
Get the domain type: Simple, Sequential, or Parallel.
Definition: FitDialog.h:124
int m_domainIndex
In multidomain fitting it is index of domain created from this workspace In single domain case == 0.
Definition: FitDialog.h:143
int getDomainIndex() const
Return the domain index.
Definition: FitDialog.h:118
void setWorkspaceName(const QString &wsName)
Set workspace name.
Definition: FitDialog.cpp:141
void setDynamicProperties()
Set the dynamic properties.
Definition: FitDialog.cpp:109
void setPropertyValue(const QString &propName, const QString &propValue)
Set a property.
Definition: FitDialog.cpp:153
QString getWorkspaceName() const
Get workspace name.
Definition: FitDialog.cpp:138
DynamicPropertiesWidget * m_dynamicProperties
Dynamic propeties widget.
Definition: FitDialog.h:149
bool isWSNameSet() const
Is ws name set?
Definition: FitDialog.cpp:66
QVBoxLayout * m_layout
The main layout.
Definition: FitDialog.h:152
void setProperties()
Set all workspace properties.
Definition: FitDialog.cpp:163
QStringList getAllowedPropertyValues(const QString &propName) const
Get allowed values for a property.
Definition: FitDialog.h:110
QString getStoredPropertyValue(const QString &propName) const
Return property value stored in history.
Definition: FitDialog.h:108
QComboBox * m_workspaceName
Workspace name widget.
Definition: FitDialog.h:147
FitDialog * m_fitDialog
Parent FitDialog.
Definition: FitDialog.h:140
QString m_wsPropName
Name of the property for the input workspace.
Definition: FitDialog.h:145
bool isMDWorkspace() const
Is the workspace MD?
Definition: FitDialog.cpp:89
Widgets to set properties for a IMDWorkspace: MaxSize.
Definition: FitDialog.h:193
void setProperties() override
Set all workspace properties.
Definition: FitDialog.cpp:281
void init() override
Initialize the child widgets with stored and allowed values.
Definition: FitDialog.h:197
Widgets to set properties for a MatrixWorkspace: WorkspaceIndex, StartX, EndX.
Definition: FitDialog.h:175
void setProperties() override
Set all workspace properties.
Definition: FitDialog.cpp:224
void init() override
Initialize the child widgets with stored and allowed values.
Definition: FitDialog.cpp:219
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...