Problem solved
I solved the "problem" (althought it wasn't a problem) after several hours, and it was very simple.
As I didn't get a solution from the forum, I decided to contact to NCReport support (from http://www.nocisoft.com). I wrote an email telling them what was my problem and blah blah.
I wasn't expecting an answer, but 10 minutes later, I get an email with the answer from the support telling me some things to try.
I answered them with some other stuff and some hours later, I realized that the solution was to put some libraries into the directory where the .exe is (it was THAT SIMPLE).
For all those who had the same problem, I hope to help them:
In your pro file, put the following:
DEFINES += NCREPORT_IMPORT
LIBS += bin\ncreport2.dll
INCLUDEPATH += "REPLACE HERE THE PATH TO NCREPORT ROOT FOLDER\include"
QT += xml sql
TEMPLATE = app
DEFINES += QT_NO_DEBUG_OUTPUT
CONFIG += warn_on \
qt \
thread \
release
DEFINES += NCREPORT_IMPORT
LIBS += bin\ncreport2.dll
INCLUDEPATH += "REPLACE HERE THE PATH TO NCREPORT ROOT FOLDER\include"
QT += xml sql
TEMPLATE = app
DEFINES += QT_NO_DEBUG_OUTPUT
CONFIG += warn_on \
qt \
thread \
release
To copy to clipboard, switch view to plain text mode
Then, in the file where you are going to use the report:
#include "ncreport.h"
#include "ncreportoutput.h"
#include "ncreportpreviewoutput.h"
#include "info.h"
#include "ncreportpreviewwindow.h"
#include "utils.h"
#include "ncreport.h"
#include "ncreportoutput.h"
#include "ncreportpreviewoutput.h"
#include "info.h"
#include "ncreportpreviewwindow.h"
#include "utils.h"
To copy to clipboard, switch view to plain text mode
NCReport *report = new NCReport();
report->reset();
report->clearBatch();
report->setReportFile("PATH TO THE REPORT");
report->addItemModel(im, "model1");
report->runReportToPreview();
if (!report->hasError()){
NCReportPreviewWindow *pv = new NCReportPreviewWindow();
pv->setOutput( (NCReportPreviewOutput*)report->output() );
pv->setWindowModality( Qt::ApplicationModal );
pv->setAttribute( Qt::WA_DeleteOnClose );
pv->show();
}
NCReport *report = new NCReport();
report->reset();
report->clearBatch();
report->setReportFile("PATH TO THE REPORT");
report->addItemModel(im, "model1");
report->runReportToPreview();
if (!report->hasError()){
NCReportPreviewWindow *pv = new NCReportPreviewWindow();
pv->setOutput( (NCReportPreviewOutput*)report->output() );
pv->setWindowModality( Qt::ApplicationModal );
pv->setAttribute( Qt::WA_DeleteOnClose );
pv->show();
}
To copy to clipboard, switch view to plain text mode
And you have to copy the libraries that are in (NCREPORT FOLDER)/bin to the folder where your application is. Some libraries are optional.
I hope to help someone, it's a very simple task, but the documentation didn't say that (or I missed it).
Best regards,
Facundo.
Bookmarks