Skip to content
Snippets Groups Projects
Commit e38713f1 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Commented code

parent 3d7e9542
No related branches found
No related tags found
No related merge requests found
...@@ -98,31 +98,20 @@ const SessionItem* PropertyWidgetItem::item() ...@@ -98,31 +98,20 @@ const SessionItem* PropertyWidgetItem::item()
void PropertyWidgetItem::connectEditor(QWidget* editor) void PropertyWidgetItem::connectEditor(QWidget* editor)
{ {
if (auto combo = dynamic_cast<ComboPropertyEditor*>(editor)) { if (auto combo = dynamic_cast<ComboPropertyEditor*>(editor)) {
// Hack: QDataWidgetMapper doesn't listen for the widget (QComboBox is somewhat special).
// connect(combo, &ComboPropertyEditor::currentIndexChanged,
// [=] { m_delegate->commitData(combo); });
connect(combo, &ComboPropertyEditor::dataChanged, connect(combo, &ComboPropertyEditor::dataChanged,
[=] { m_delegate->commitData(combo); }); [=] { m_delegate->commitData(combo); });
// TODO after merging GroupProperty and ComboProperty
// 1) cast to CustomEditor
// 2) switch to CustomEditor::dataChanged()
} else if (auto spinbox = dynamic_cast<QSpinBox*>(editor)) { } else if (auto spinbox = dynamic_cast<QSpinBox*>(editor)) {
// To provide update of the model on valueChanged() and not only on editingFinished()
connect(spinbox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), connect(spinbox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
[=] { m_delegate->commitData(spinbox); }); [=] { m_delegate->commitData(spinbox); });
} else if (auto spinbox = dynamic_cast<QDoubleSpinBox*>(editor)) { } else if (auto spinbox = dynamic_cast<QDoubleSpinBox*>(editor)) {
// To provide update of the model on valueChanged() and not only on editingFinished()
connect(spinbox, connect(spinbox,
static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
[=] { m_delegate->commitData(spinbox); }); [=] { m_delegate->commitData(spinbox); });
} else if (auto spinbox = dynamic_cast<ScientificDoublePropertyEditor*>(editor)) { } else if (auto spinbox = dynamic_cast<ScientificDoublePropertyEditor*>(editor)) {
// To provide update of the model on valueChanged() and not only on editingFinished()
connect(spinbox, &ScientificDoublePropertyEditor::dataChanged, connect(spinbox, &ScientificDoublePropertyEditor::dataChanged,
[=] { m_delegate->commitData(spinbox); }); [=] { m_delegate->commitData(spinbox); });
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment