Report::ReportInterface* report = 0; Report::ReportEngine reportEngine; report = reportEngine.loadReport("current.bdrt"); if (!report) { qCritical()<<"Error: Can't open the report"; return; }
ReportInterface* ReportEngine::loadReport(const QString & fileName){ ReportInterface* report = 0; QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { report = dynamic_cast<ReportInterface*>(loadReport(&file)); file.close(); } return report;}ReportInterface* ReportEngine::loadReport(QIODevice * device){ QDomDocument doc("report"); if (!doc.setContent(device->readAll())) return 0; return dynamic_cast<Report::ReportInterface*>(objectFromDom(0, doc.firstChildElement()));}
-- Configuring doneWARNING: Target "Ods" requests linking to directory "C:/dev/quazip-package/lib". Targets may link only to libraries. CMake is dropping the item.WARNING: Target "exaro" requests linking to directory "C:/dev/propertyEditor-package/include". Targets may link only to libraries. CMake is dropping the item.-- Generating done-- Build files have been written to: C:/dev/exaro/build
[ 37%] Building CXX object plugins/report/export/ods/CMakeFiles/Ods.dir/qrc_odsResource.cxx.objLinking CXX shared library libOds.dllCreating library file: libOds.dll.aCMakeFiles\Ods.dir/objects.a(ods.cpp.obj):C:/dev/exaro/plugins/report/export/ods/ods.cpp:123: undefined reference to `QuaZip::QuaZip(QString const&)'CMakeFiles\Ods.dir/objects.a(ods.cpp.obj):C:/dev/exaro/plugins/report/export/ods/ods.cpp:124: undefined reference to `QuaZip::open(QuaZip::Mode, zlib_filefunc_def_s*)'
report = reportEngine.loadReport("Report.bdrt");
return dynamic_cast<Report::ReportInterface*>(objectFromDom(0, doc.firstChildElement()));....................................QObject * ReportEngine::objectFromDom(QObject * parent, const QDomElement & dom){ QObject * obj = 0; for (int r = 0;r < m_reports.size();r++) if (dom.tagName() == m_reports[r]->metaObject()->className()) { obj = m_reports[r]->createInstance(parent); setObjectPropertiesFromDom(obj, dom); break; } if (!obj) for (int p = 0;p < m_pages.size();p++) if (dom.tagName() == m_pages[p]->metaObject()->className()) { obj = m_pages[p]->createInstance(parent); setObjectPropertiesFromDom(obj, dom); break; } if (!obj) for (int i = 0;i < m_items.size();i++) if (dom.tagName() == m_items.values()[i]->metaObject()->className()) { obj = m_items.values()[i]->createInstance(dynamic_cast<QGraphicsItem*>(parent), parent); if (dynamic_cast<Report::PageInterface*>(parent)) dynamic_cast<Report::PageInterface*>(parent)->addItem(dynamic_cast<QGraphicsItem*>(obj)); setObjectPropertiesFromDom(obj, dom); break; } if (obj) for (QDomElement ch = dom.firstChildElement("children").firstChildElement();!ch.isNull();ch = ch.nextSiblingElement()) objectFromDom(obj, ch); else qWarning() << tr("Can't find %1").arg(dom.tagName()); return obj;}