-- pre fy
This commit is contained in:
@@ -253,29 +253,29 @@ void XQItemDelegate::setEditorData(QWidget* editor, const QModelIndex& index) co
|
|||||||
|
|
||||||
switch( edType )
|
switch( edType )
|
||||||
{
|
{
|
||||||
case XQItemType::ComboBoxType :
|
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())
|
|
||||||
{
|
{
|
||||||
if (!value.isValid())
|
QComboBox* comboBox = qobject_cast<QComboBox*>(editor);
|
||||||
value = QVariant(editor->property(userProp).metaType());
|
comboBox->setModel( item.fixedChoices());
|
||||||
editor->setProperty(userProp, value);
|
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