Issue #77 Break cyclic dependency between CVariant and CVariantList

This commit is contained in:
Mat Sutcliffe
2020-11-08 19:37:02 +00:00
parent 4df055afbe
commit 2435350e17
4 changed files with 17 additions and 16 deletions

View File

@@ -12,6 +12,9 @@
namespace BlackMisc
{
//! \private
extern int qMetaTypeId_CVariantList; // defined in variant.cpp
CVariantList::CVariantList(const CSequence &other) : CSequence(other)
{}
@@ -25,16 +28,12 @@ namespace BlackMisc
std::move(other.begin(), other.end(), std::back_inserter(*this));
}
CVariantList::CVariantList(const QSequentialIterable &other)
{
for (auto it = other.begin(); it != other.end(); ++it) { push_back(*it); }
}
void CVariantList::registerMetadata()
{
Mixin::MetaType<CVariantList>::registerMetadata();
QMetaType::registerConverter<CVariantList, QVector<CVariant>>([](const CVariantList &list) { return list.toVector(); });
QMetaType::registerConverter<QVector<CVariant>, CVariantList>([](const QVector<CVariant> &list) { return CSequence(list); });
qMetaTypeId_CVariantList = qMetaTypeId<CVariantList>();
}
bool CVariantList::matches(const CVariant &event) const