From ae4b64b198a143240aa5dd1e202e5016abfdae71 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 8 Dec 2016 13:18:19 +0100 Subject: Wrap references in a Reerence type. This allows us to make sure that references are not taken out of context (the resource). Because we need to use the type-specific accessors more we also ran into a problem that we cannot "downcast" a reference with the change recording still working, for that we have the cast() operator now. --- common/typeindex.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'common/typeindex.cpp') diff --git a/common/typeindex.cpp b/common/typeindex.cpp index b0494f3..9d71463 100644 --- a/common/typeindex.cpp +++ b/common/typeindex.cpp @@ -34,6 +34,12 @@ static QByteArray getByteArray(const QVariant &value) return "nodate"; } } + if (value.canConvert()) { + const auto ba = value.value().value; + if (!ba.isEmpty()) { + return ba; + } + } if (value.isValid() && !value.toByteArray().isEmpty()) { return value.toByteArray(); } -- cgit v1.2.3