forked from qt-creator/qt-creator
Utils: Introduce variantFromStore and storeFromVariant
These are functional replacements for QVariant::fromValue(QVariantMap) (or QVariant::fromValue(Store)) and QVariant::toMap() (or QVariant::toValue<Store>()) We will have a few code paths in the end that need to explicitly operarate on both QVariantMap and Store (e.g. actual reading/writing to keep format compatibility etc), so these can't in the end be simple to/fromValue(OneType) but need an internal 'if' or such. Change-Id: I954f3cb24fa8fe123162b72bbd25d891dd19b768 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -144,8 +144,8 @@ Store CustomParserSettings::toMap() const
|
||||
Store map;
|
||||
map.insert(idKey, id.toSetting());
|
||||
map.insert(nameKey, displayName);
|
||||
map.insert(errorKey, QVariant::fromValue(error.toMap()));
|
||||
map.insert(warningKey, QVariant::fromValue(warning.toMap()));
|
||||
map.insert(errorKey, variantFromStore(error.toMap()));
|
||||
map.insert(warningKey, variantFromStore(warning.toMap()));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -153,8 +153,8 @@ void CustomParserSettings::fromMap(const Store &map)
|
||||
{
|
||||
id = Id::fromSetting(map.value(idKey));
|
||||
displayName = map.value(nameKey).toString();
|
||||
error.fromMap(map.value(errorKey).value<Store>());
|
||||
warning.fromMap(map.value(warningKey).value<Store>());
|
||||
error.fromMap(storeFromVariant(map.value(errorKey)));
|
||||
warning.fromMap(storeFromVariant(map.value(warningKey)));
|
||||
}
|
||||
|
||||
CustomParsersAspect::CustomParsersAspect(Target *target)
|
||||
|
||||
Reference in New Issue
Block a user