From 659a2dea00674954695ce302bcc323bb405c91ac Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 29 Jun 2016 21:24:54 +0300 Subject: [PATCH] Fixed writing of variables --- limereport/lrvariablesholder.cpp | 2 +- limereport/serializators/lrxmlwriter.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/limereport/lrvariablesholder.cpp b/limereport/lrvariablesholder.cpp index b9a92ea..ed98f83 100644 --- a/limereport/lrvariablesholder.cpp +++ b/limereport/lrvariablesholder.cpp @@ -59,7 +59,7 @@ void VariablesHolder::addVariable(const QString& name, const QVariant& value, Va varValue->setVarType(type); varValue->setRenderPass(pass); m_varNames.insert(name,varValue); - if (type==VarDesc::User) + if (type==VarDesc::Report) m_userVariables.append(varValue); } else { throw ReportError(tr("variable with name ")+name+tr(" already exists !!")); diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index de1b9fb..3a06dd5 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -118,8 +118,13 @@ QDomElement XMLWriter::putQObjectItem(QString name, QObject *item) void XMLWriter::saveProperty(QString name, QObject* item, QDomElement *node) { - CreateSerializator creator=0; + QString typeName; + if (name.compare("itemIndexMethod")==0) + typeName = item->metaObject()->property(item->metaObject()->indexOfProperty(name.toLatin1())).typeName(); + else + typeName = item->property(name.toLatin1()).typeName(); + CreateSerializator creator=0; if (isCollection(name,item)) { saveCollection(name,item,node); return;} if (isQObject(name,item)) { if (qvariant_cast(item->property(name.toLatin1()))) @@ -136,12 +141,10 @@ void XMLWriter::saveProperty(QString name, QObject* item, QDomElement *node) ); else try { - creator=XMLAbstractSerializatorFactory::instance().objectCreator( - item->metaObject()->property(item->metaObject()->indexOfProperty(name.toLatin1())).typeName() - ); + creator=XMLAbstractSerializatorFactory::instance().objectCreator(typeName); } catch (LimeReport::ReportError &exception){ qDebug()<<"class name ="<metaObject()->className() - <<"property name="<