Skip to content

Commit

Permalink
player: store enum option sas string to avoid set property error
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 16, 2014
1 parent f67725a commit 52a78cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/player/config/PropertyEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ void PropertyEditor::getProperties(QObject *obj)
for (int i = 0; i < mo->propertyCount(); ++i) {
QMetaProperty mp = mo->property(i);
mMetaProperties.append(mp);
mProperties.insert(mp.name(), mp.read(obj));
QVariant v(mp.read(obj));
if (mp.isEnumType()) {
mProperties.insert(mp.name(), mp.enumerator().valueToKey(v.toInt())); //always use string
} else {
mProperties.insert(mp.name(), v);
}
}
mProperties.remove("objectName");
}

void PropertyEditor::set(const QVariantHash &hash)
Expand Down

0 comments on commit 52a78cd

Please sign in to comment.