-- pre fy
This commit is contained in:
@@ -253,29 +253,29 @@ void XQItemDelegate::setEditorData(QWidget* editor, const QModelIndex& index) co
|
||||
|
||||
switch( edType )
|
||||
{
|
||||
case XQItemType::ComboBoxType :
|
||||
{
|
||||
QComboBox* comboBox = qobject_cast<QComboBox*>(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<QComboBox*>(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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user