forked from qt-creator/qt-creator
Utils: Write Key/Store to settings
We claim that we still store QVariantMap to keep the format unchanged. Change-Id: Ie7b0a83febfeb2cb3cfc9ee42b8423453cf3b1c4 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "store.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "qtcassert.h"
|
||||
|
||||
namespace Utils {
|
||||
|
||||
@@ -24,7 +25,14 @@ QVariant variantFromStore(const Store &store)
|
||||
|
||||
Store storeFromVariant(const QVariant &value)
|
||||
{
|
||||
return value.value<Store>();
|
||||
if (value.typeId() == qMetaTypeId<Store>())
|
||||
return value.value<Store>();
|
||||
|
||||
if (value.typeId() == QMetaType::QVariantMap)
|
||||
return storeFromMap(value.toMap());
|
||||
|
||||
QTC_CHECK(false);
|
||||
return Store();
|
||||
}
|
||||
|
||||
#ifdef QTC_USE_STORE
|
||||
@@ -99,4 +107,10 @@ QVariantMap mapFromStore(const Store &store)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isStore(const QVariant &value)
|
||||
{
|
||||
const int typeId = value.typeId();
|
||||
return typeId == QMetaType::QVariantMap || typeId == qMetaTypeId<Store>();
|
||||
}
|
||||
|
||||
} // Utils
|
||||
|
||||
Reference in New Issue
Block a user