LimeReport Forum
General Category | Основное => Discussion | Обсуждение => Topic started by: falcon on March 16, 2018, 05:28:25 pm
-
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 ?
-
Hello!
I read your question and thought why not. In the result I made changes to the develop branch and now the pictures can be transferred to the report via a variable.
-
Hello Alex,
First, I would like to thank you a lot for your help.
That was quick and efficient. ;D
I tried to download the "develop branch" from git and build it.
Everythings seams to works good but when I compile my soft I have an error:
C:\LimeReport-master\Lib\include\lrglobal.h:49: erreur : QScriptEngine: No such file or directory
The error is there:
#ifdef USE_QJSENGINE
//#include <QJSEngine>
#include <QQmlEngine>
#else
#include <QScriptEngine> <==(!)=====(!)======(!)== (line 49)
#endif
What is the problem ?
-
Hi!
I made some new changes in develop branch.
You can try again to get sources and build it.
Important: before build new sources clean project and run qmake.