BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Custom editor for table/tree cells to select ExternalProperty from the list of external properties. More...
Public Types | |
using | callback_t = std::function< std::vector< ModelView::ExternalProperty >()> |
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 | |
ExternalPropertyComboEditor (callback_t callback, QWidget *parent=nullptr) | |
QVariant | data () const |
virtual bool | is_persistent () const |
Returns true if editor should remains alive after editing finished. More... | |
QSize | minimumSizeHint () const override |
QSize | sizeHint () const override |
Protected Slots | |
virtual void | onIndexChanged (int index) |
Protected Member Functions | |
void | setDataIntern (const QVariant &data) |
Saves the data as given by editor's internal components and notifies the model. More... | |
Protected Attributes | |
QVariant | m_data |
Properties | |
QVariant | value |
Private Member Functions | |
int | internIndex () |
Returns index for QComboBox. More... | |
void | setConnected (bool isConnected) |
void | update_components () override |
Should update widget components from m_data, if necessary. More... | |
Private Attributes | |
QComboBox * | m_box {nullptr} |
QStandardItemModel * | m_comboModel {nullptr} |
callback_t | m_getPropertiesCallback |
Custom editor for table/tree cells to select ExternalProperty from the list of external properties.
Uses callbacks to retrieve vector of possible properties.
Definition at line 32 of file externalpropertycomboeditor.h.
using ModelView::ExternalPropertyComboEditor::callback_t = std::function<std::vector<ModelView::ExternalProperty>()> |
Definition at line 36 of file externalpropertycomboeditor.h.
ExternalPropertyComboEditor::ExternalPropertyComboEditor | ( | callback_t | callback, |
QWidget * | parent = nullptr |
||
) |
Definition at line 24 of file externalpropertycomboeditor.cpp.
References m_box, m_comboModel, and setConnected().
|
inherited |
Definition at line 21 of file customeditor.cpp.
References ModelView::CustomEditor::m_data.
Referenced by ModelView::CustomEditor::setData(), and ModelView::CustomEditor::setDataIntern().
|
signalinherited |
Emmits signal when data was changed in an editor.
Referenced by ModelView::PropertyFlatView::PropertyFlatViewImpl::create_editor(), ModelView::ViewModelDelegate::createEditor(), and ModelView::CustomEditor::setDataIntern().
|
private |
Returns index for QComboBox.
Definition at line 85 of file externalpropertycomboeditor.cpp.
References ModelView::CustomEditor::m_data, and m_getPropertiesCallback.
Referenced by update_components().
|
virtualinherited |
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.
|
override |
Definition at line 49 of file externalpropertycomboeditor.cpp.
References m_box.
|
protectedvirtualslot |
Definition at line 54 of file externalpropertycomboeditor.cpp.
References ModelView::CustomEditor::m_data, m_getPropertiesCallback, and ModelView::CustomEditor::setDataIntern().
Referenced by setConnected().
|
private |
Definition at line 101 of file externalpropertycomboeditor.cpp.
References m_box, and onIndexChanged().
Referenced by ExternalPropertyComboEditor(), and update_components().
|
slotinherited |
Sets the data from model to editor.
Definition at line 35 of file customeditor.cpp.
References ModelView::CustomEditor::data(), ModelView::CustomEditor::m_data, and ModelView::CustomEditor::update_components().
|
protectedinherited |
Saves the data as given by editor's internal components and notifies the model.
Definition at line 43 of file customeditor.cpp.
References ModelView::CustomEditor::data(), ModelView::CustomEditor::dataChanged(), and ModelView::CustomEditor::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(), onIndexChanged(), and ModelView::SelectableComboBoxEditor::onModelDataChanged().
|
override |
Definition at line 44 of file externalpropertycomboeditor.cpp.
References m_box.
|
overrideprivatevirtual |
Should update widget components from m_data, if necessary.
Implements ModelView::CustomEditor.
Definition at line 65 of file externalpropertycomboeditor.cpp.
References SessionItemUtils::DecorationRole(), internIndex(), m_box, m_comboModel, m_getPropertiesCallback, and setConnected().
|
private |
Definition at line 52 of file externalpropertycomboeditor.h.
Referenced by ExternalPropertyComboEditor(), minimumSizeHint(), setConnected(), sizeHint(), and update_components().
|
private |
Definition at line 53 of file externalpropertycomboeditor.h.
Referenced by ExternalPropertyComboEditor(), and update_components().
|
protectedinherited |
Definition at line 48 of file customeditor.h.
Referenced by ModelView::ExternalPropertyEditor::buttonClicked(), ModelView::ColorEditor::currentColor(), ModelView::CustomEditor::data(), ModelView::ComboPropertyEditor::internIndex(), internIndex(), ModelView::ComboPropertyEditor::internLabels(), ModelView::BoolEditor::onCheckBoxChange(), ModelView::DoubleEditor::onEditingFinished(), ModelView::IntegerEditor::onEditingFinished(), ModelView::ScientificDoubleEditor::onEditingFinished(), ModelView::ScientificSpinBoxEditor::onEditingFinished(), ModelView::ComboPropertyEditor::onIndexChanged(), onIndexChanged(), ModelView::SelectableComboBoxEditor::onModelDataChanged(), ModelView::CustomEditor::setData(), ModelView::CustomEditor::setDataIntern(), ModelView::BoolEditor::update_components(), ModelView::ColorEditor::update_components(), ModelView::DoubleEditor::update_components(), ModelView::ExternalPropertyEditor::update_components(), ModelView::IntegerEditor::update_components(), ModelView::ScientificDoubleEditor::update_components(), ModelView::ScientificSpinBoxEditor::update_components(), ModelView::SelectableComboBoxEditor::update_components(), and ModelView::SelectableComboBoxEditor::updateBoxLabel().
|
private |
Definition at line 51 of file externalpropertycomboeditor.h.
Referenced by internIndex(), onIndexChanged(), and update_components().
|
readwriteinherited |
Definition at line 1 of file customeditor.h.
Referenced by ModelView::BoolEditor::onCheckBoxChange(), ModelView::DoubleEditor::setSingleStep(), and ModelView::BoolEditor::update_components().