Hi guys, I am using this report generator and I managed to design my report and then link it to my form, I managed to show the report from a button, my question is how do I change the path from where I have the database dynamically, that is, to the move the database or when distributing my app to another computer, since I have to be editing the lrxml file, to change the path manually, I am using a SQlite db for now. Thanks, I hope your suggestions.
code of my button where I show the report, I have it added as a resource of my application...
void Widget::on_btnReporte_clicked()
{
QFile reportName(":/reports/ejemplo.lrxml");
if(!reportName.open(QIODevice::ReadOnly|QIODevice::Text))
{
QMessageBox::critical(this,qApp->applicationName(),
"Ocurrio un error al cargar el reporte.0\n"+reportName.errorString());
return;
}
_report=new LimeReport::ReportEngine(this);
_report->loadFromFile(reportName.fileName());
_report->previewReport();
}
<datasourcesManager ClassName="LimeReport::DataSourceManager" Type="Object">
<objectName Type="QString">datasources</objectName>
<connections Type="Collection">
<item ClassName="LimeReport::ConnectionDesc" Type="Object">
<objectName Type="QString"></objectName>
<name Type="QString">reporte</name>
<driver Type="QString">QSQLITE</driver>
[b]<databaseName Type="QString">D:/QtProjects/BranchExe/db/dbejemplo.db</databaseName>[/b]
<userName Type="QString"></userName>
<password Type="QString" Value=""/>
<host Type="QString"></host>
<autoconnect Type="bool" Value="1"/>
<keepDBCredentials Type="bool" Value="1"/>
<port Type="int" Value="-1"/>
</item>
</connections>
This is the part I am referring to, in the databaseName tag, how do I get that path changed, without having to do it manually.