Mantid
Loading...
Searching...
No Matches
LocalParameterItemDelegate.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 <QStyledItemDelegate>
10
11namespace MantidQt {
12namespace MantidWidgets {
13
14// Forward declarations.
15class EditLocalParameterDialog;
16class LocalParameterEditor;
17
26class LocalParameterItemDelegate : public QStyledItemDelegate {
27 Q_OBJECT
28public:
29 explicit LocalParameterItemDelegate(EditLocalParameterDialog *parent = nullptr);
30 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
31 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
32 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
34
35signals:
36 void setAllValues(double /*_t1*/);
37 void fixParameter(int /*_t1*/, bool /*_t2*/);
38 void setAllFixed(bool /*_t1*/);
39 void setTie(int /*_t1*/, QString /*_t2*/);
40 void setTieAll(QString /*_t1*/);
41 void setConstraint(int /*_t1*/, QString /*_t2*/);
42 void setConstraintAll(QString /*_t1*/);
43 void setValueToLog(int /*_t1*/);
45
46protected:
47 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
48
49private slots:
50 void doSetValueToLog(int /*i*/);
52
53private:
54 bool eventFilter(QObject *obj, QEvent *ev) override;
57};
58
59} // namespace MantidWidgets
60} // namespace MantidQt
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
double obj
the value of the quadratic function
A dialog for displaying and editing values of local parameters.
An editor widget for editing a local parameter value.
A custom item delegate - an object controlling display and editing of a cell in a table widget.
void doSetValueToLog(int)
Slot: close the editor and re-emit the signal.
void prepareForPastedData()
Data is about to be pasted into the table.
void doSetAllValuesToLog()
Slot: close the editor and re-emit the signal.
void setEditorData(QWidget *editor, const QModelIndex &index) const override
Initialize the editor with the current data in the cell.
EditLocalParameterDialog * owner() const
Cast the parent to EditLocalParameterDialog.
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Create a custom editor LocalParameterEditor.
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Update the data in the cell with the text in the editor.
bool eventFilter(QObject *obj, QEvent *ev) override
Re-implemented to resolve an issue: if the parent dialog closes with the editor is active any changes...
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Paint the table cell.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...