BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::CustomEditor Class Referenceabstract

Base class for all custom variant editors. More...

Inheritance diagram for ModelView::CustomEditor:
[legend]
Collaboration diagram for ModelView::CustomEditor:
[legend]

Public Slots

void setData (const QVariant &data)
 Sets the data from model to editor. More...
 

Signals

void dataChanged (QVariant value)
 Emmits signal when data was changed in an editor. More...
 

Public Member Functions

 CustomEditor (QWidget *parent=nullptr)
 
QVariant data () const
 
virtual bool is_persistent () const
 Returns true if editor should remains alive after editing finished. More...
 

Protected Member Functions

void setDataIntern (const QVariant &data)
 Saves the data as given by editor's internal components and notifies the model. More...
 
virtual void update_components ()=0
 Should update widget components from m_data, if necessary. More...
 

Protected Attributes

QVariant m_data
 

Properties

QVariant value
 

Detailed Description

Base class for all custom variant editors.

Definition at line 26 of file customeditor.h.

Constructor & Destructor Documentation

◆ CustomEditor()

CustomEditor::CustomEditor ( QWidget *  parent = nullptr)
explicit

Definition at line 19 of file customeditor.cpp.

19 : QWidget(parent) {}

Member Function Documentation

◆ data()

QVariant CustomEditor::data ( ) const

Definition at line 21 of file customeditor.cpp.

22 {
23  return m_data;
24 }

References m_data.

Referenced by setData(), and setDataIntern().

◆ dataChanged

void ModelView::CustomEditor::dataChanged ( QVariant  value)
signal

◆ is_persistent()

bool CustomEditor::is_persistent ( ) const
virtual

Returns true if editor should remains alive after editing finished.

Reimplemented in ModelView::SelectableComboBoxEditor, ModelView::ScientificSpinBoxEditor, ModelView::ComboPropertyEditor, and ModelView::BoolEditor.

Definition at line 28 of file customeditor.cpp.

29 {
30  return false;
31 }

◆ setData

void CustomEditor::setData ( const QVariant &  data)
slot

Sets the data from model to editor.

Definition at line 35 of file customeditor.cpp.

36 {
37  m_data = data;
39 }
QVariant data() const
virtual void update_components()=0
Should update widget components from m_data, if necessary.

References data(), m_data, and update_components().

Here is the call graph for this function:

◆ setDataIntern()

void CustomEditor::setDataIntern ( const QVariant &  data)
protected

Saves the data as given by editor's internal components and notifies the model.

Definition at line 43 of file customeditor.cpp.

44 {
45  m_data = data;
47 }
void dataChanged(QVariant value)
Emmits signal when data was changed in an editor.

References data(), dataChanged(), and m_data.

Referenced by ModelView::ColorEditor::mousePressEvent(), ModelView::BoolEditor::onCheckBoxChange(), ModelView::DoubleEditor::onEditingFinished(), ModelView::IntegerEditor::onEditingFinished(), ModelView::ScientificDoubleEditor::onEditingFinished(), ModelView::ScientificSpinBoxEditor::onEditingFinished(), ModelView::ComboPropertyEditor::onIndexChanged(), ModelView::ExternalPropertyComboEditor::onIndexChanged(), and ModelView::SelectableComboBoxEditor::onModelDataChanged().

Here is the call graph for this function:

◆ update_components()

Member Data Documentation

◆ m_data

Property Documentation

◆ value

QVariant ModelView::CustomEditor::value
readwrite

The documentation for this class was generated from the following files: