Hello everybody,
I'm a beginner with Qt and LimeReport and I try to print a picture from my c++ code to my Lime Report Template.
I already success to write a variable from my c++ code to the PDF file with the template.
To do that I created a new "Report variables" in "Data Browser -> Variables". Then, I created a new "TextItem" and in the "Property Name" to "content", I write "$V{number}" to reference the "Report variables" with the same name. I don't know if it's right but it's works.
You can see my code.
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
report(new LimeReport::ReportEngine),
{
ui->setupUi(this);
this->number = 0;
this->report = new LimeReport::ReportEngine(parent);
this->report->loadFromFile("lrTemplate01.lrxml");
}
void MainWindow::on_pushButton_clicked()
{
QPixmap p = ui->qgvChart->grab();
this->report->dataManager()->setReportVariable("number", this->number++);
p.save("a.png", "PNG", 100);
this->report->previewReport();
}
void MainWindow::on_pushButton_2_clicked()
{
this->report->printToPDF("report");
}
The question is, how can I do that for a picture.
I have "p" that is my "QPixmap" and I would like to do something like:
this->report->dataManager()->setReportVariable("image", p);
But I have no idea how it's possible and what kind of "variables" I have to create on the "Line Report Designer".
Somebody can please help me ?