BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Adds multi-selection capabilities to QComboBox. More...
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 | |
SelectableComboBoxEditor (QWidget *parent=nullptr) | |
QVariant | data () const |
bool | is_persistent () const override |
Returns true if editor should remains alive after editing finished. More... | |
QSize | minimumSizeHint () const override |
QSize | sizeHint () const override |
Protected Slots | |
void | onClickedList (const QModelIndex &index) |
Processes press event in QComboBox's underlying list view. More... | |
void | onModelDataChanged (const QModelIndex &, const QModelIndex &, const QVector< int > &) |
Propagate check state from the model to ComboProperty. More... | |
Protected Member Functions | |
void | setDataIntern (const QVariant &data) |
Saves the data as given by editor's internal components and notifies the model. More... | |
void | update_components () override |
Should update widget components from m_data, if necessary. More... | |
Protected Attributes | |
QVariant | m_data |
Properties | |
QVariant | value |
Private Member Functions | |
bool | eventFilter (QObject *obj, QEvent *event) override |
Handles mouse clicks on QComboBox elements. More... | |
bool | isClickToExpand (QObject *obj, QEvent *event) const |
bool | isClickToSelect (QObject *obj, QEvent *event) const |
void | setConnected (bool isConnected) |
void | updateBoxLabel () |
Update text on QComboBox with the label provided by combo property. More... | |
Private Attributes | |
QComboBox * | m_box {nullptr} |
QStandardItemModel * | m_model {nullptr} |
WheelEventFilter * | m_wheelEventFilter {nullptr} |
Adds multi-selection capabilities to QComboBox.
Definition at line 29 of file selectablecomboboxeditor.h.
|
explicit |
Definition at line 53 of file selectablecomboboxeditor.cpp.
References m_box, m_model, m_wheelEventFilter, 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().
|
overrideprivate |
Handles mouse clicks on QComboBox elements.
Definition at line 134 of file selectablecomboboxeditor.cpp.
References isClickToExpand(), isClickToSelect(), m_box, and onClickedList().
|
overridevirtual |
Returns true if editor should remains alive after editing finished.
Reimplemented from ModelView::CustomEditor.
Definition at line 94 of file selectablecomboboxeditor.cpp.
|
private |
Definition at line 208 of file selectablecomboboxeditor.cpp.
References m_box.
Referenced by eventFilter().
|
private |
Definition at line 203 of file selectablecomboboxeditor.cpp.
References m_box.
Referenced by eventFilter().
|
override |
Definition at line 89 of file selectablecomboboxeditor.cpp.
References m_box.
|
protectedslot |
Processes press event in QComboBox's underlying list view.
Definition at line 124 of file selectablecomboboxeditor.cpp.
References m_model.
Referenced by eventFilter().
|
protectedslot |
Propagate check state from the model to ComboProperty.
Definition at line 101 of file selectablecomboboxeditor.cpp.
References SessionItemUtils::CheckStateRole(), ModelView::CustomEditor::m_data, m_model, ModelView::CustomEditor::setDataIntern(), ModelView::ComboProperty::setSelected(), and updateBoxLabel().
Referenced by setConnected().
|
private |
Definition at line 184 of file selectablecomboboxeditor.cpp.
References m_model, and onModelDataChanged().
Referenced by SelectableComboBoxEditor(), 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(), ModelView::ExternalPropertyComboEditor::onIndexChanged(), and onModelDataChanged().
|
override |
Definition at line 84 of file selectablecomboboxeditor.cpp.
References m_box.
|
overrideprotectedvirtual |
Should update widget components from m_data, if necessary.
Implements ModelView::CustomEditor.
Definition at line 157 of file selectablecomboboxeditor.cpp.
References SessionItemUtils::CheckStateRole(), ModelView::Utils::Contains(), ModelView::CustomEditor::m_data, m_model, setConnected(), and updateBoxLabel().
|
private |
Update text on QComboBox with the label provided by combo property.
Definition at line 197 of file selectablecomboboxeditor.cpp.
References ModelView::ComboProperty::label(), m_box, and ModelView::CustomEditor::m_data.
Referenced by onModelDataChanged(), and update_components().
|
private |
Definition at line 56 of file selectablecomboboxeditor.h.
Referenced by SelectableComboBoxEditor(), eventFilter(), isClickToExpand(), isClickToSelect(), minimumSizeHint(), sizeHint(), and updateBoxLabel().
|
protectedinherited |
Definition at line 48 of file customeditor.h.
Referenced by ModelView::ExternalPropertyEditor::buttonClicked(), ModelView::ColorEditor::currentColor(), ModelView::CustomEditor::data(), ModelView::ComboPropertyEditor::internIndex(), ModelView::ExternalPropertyComboEditor::internIndex(), ModelView::ComboPropertyEditor::internLabels(), ModelView::BoolEditor::onCheckBoxChange(), ModelView::DoubleEditor::onEditingFinished(), ModelView::IntegerEditor::onEditingFinished(), ModelView::ScientificDoubleEditor::onEditingFinished(), ModelView::ScientificSpinBoxEditor::onEditingFinished(), ModelView::ComboPropertyEditor::onIndexChanged(), ModelView::ExternalPropertyComboEditor::onIndexChanged(), 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(), update_components(), and updateBoxLabel().
|
private |
Definition at line 58 of file selectablecomboboxeditor.h.
Referenced by SelectableComboBoxEditor(), onClickedList(), onModelDataChanged(), setConnected(), and update_components().
|
private |
Definition at line 57 of file selectablecomboboxeditor.h.
Referenced by SelectableComboBoxEditor().
|
readwriteinherited |
Definition at line 1 of file customeditor.h.
Referenced by ModelView::BoolEditor::onCheckBoxChange(), ModelView::DoubleEditor::setSingleStep(), and ModelView::BoolEditor::update_components().