Welcome, Guest. Please login or register.
Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - solitarywolf

Pages: [1]
1
Good afternoon, A query, when showing the report with previewReport () it does not let me return to my application until I close the report, how can you solve this.



This is the code of my button that shows the report, as I said before, when the report is shown it no longer lets me return to my application, if not until closing the report, any suggestions would be appreciated.

Code: [Select]
void Widget::on_pushButton_2_clicked()
{
  QFile fileName(":/rpt/Reporteusuarios.lrxml");
  if(!fileName.open(QIODevice::ReadOnly|QIODevice::Text)){
      QMessageBox::critical(this,qApp->applicationName(),
                            QString("Error al abrir el reporte.\n").append(
                              fileName.errorString()));
      return;
    }
  mReport=new LimeReport::ReportEngine(this);
  mReport->dataManager()->setReportVariable("DATABASE",db.strConexion());
  mReport->loadFromFile(fileName.fileName());
  mReport->previewReport();

}

2
Discussion | Обсуждение / Re: dynamic path to data base
« on: May 28, 2020, 11:06:50 PM »
great friend, thanks I solved my problem.

3
Discussion | Обсуждение / Re: dynamic path to data base
« on: May 26, 2020, 11:59:16 PM »
well I did not understand that, what happens is that, I use the designer to create the report, and just call it from my app, in my application I get the address of the database with qApp-> applicationDirPath (). append (" /db/dbejemplo.db "), but this as reflected in the report, a practical example would be good, if possible.

4
Discussion | Обсуждение / dynamic path to data base
« on: May 26, 2020, 10:13:41 PM »
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...
Code: [Select]
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();
}


Code: [Select]
<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.

Pages: [1]