diff --git a/src/items/xqitemdelegate.cpp b/src/items/xqitemdelegate.cpp index c2a522a..a88d9bf 100644 --- a/src/items/xqitemdelegate.cpp +++ b/src/items/xqitemdelegate.cpp @@ -253,29 +253,29 @@ void XQItemDelegate::setEditorData(QWidget* editor, const QModelIndex& index) co switch( edType ) { - case XQItemType::ComboBoxType : - { - QComboBox* comboBox = qobject_cast(editor); - comboBox->setModel( item.fixedChoices()); - comboBox->setCurrentText( item.data().toString() ); - comboBox->showPopup(); - return; - } - - default: - - // wir benutzen hier die DisplayRole wenn der Inhalt schon formatiert ist. - int role = item.renderStyle() == XQItem::FormattedStyle ? Qt::DisplayRole : Qt::EditRole; - QVariant value = index.data(role); - - QByteArray userProp = editor->metaObject()->userProperty().name(); - if (!userProp.isEmpty()) + case XQItemType::ComboBoxType : { - if (!value.isValid()) - value = QVariant(editor->property(userProp).metaType()); - editor->setProperty(userProp, value); + QComboBox* comboBox = qobject_cast(editor); + comboBox->setModel( item.fixedChoices()); + comboBox->setCurrentText( item.data().toString() ); + comboBox->showPopup(); + return; } + default: + + // wir benutzen hier die DisplayRole wenn der Inhalt schon formatiert ist. + int role = item.renderStyle() == XQItem::FormattedStyle ? Qt::DisplayRole : Qt::EditRole; + QVariant value = index.data(role); + + QByteArray userProp = editor->metaObject()->userProperty().name(); + if (!userProp.isEmpty()) + { + if (!value.isValid()) + value = QVariant(editor->property(userProp).metaType()); + editor->setProperty(userProp, value); + } + } }