0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Fixed writing of variables

This commit is contained in:
Arin Alex 2016-06-29 21:24:54 +03:00
parent a010c2012f
commit 659a2dea00
2 changed files with 9 additions and 6 deletions

View File

@ -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 !!"));

View File

@ -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<QObject *>(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 ="<<item->metaObject()->className()
<<"property name="<<name<<" property type="<<item->property(name.toLatin1()).typeName()
<<"property name="<<name<<" property type="<<typeName
<<exception.what();
}