LimeReport Forum
General Category | Основное => Discussion | Обсуждение => Topic started by: Mucip on February 27, 2020, 06:08:19 pm
-
Hi,
I have definitons in header file like below;
QSqlQueryModel *raporModel;
LimeReport::ReportEngine *mRapor;
And in mainwindow.cpp
mRapor = new LimeReport::ReportEngine(this);
raporModel = new QSqlQueryModel(this);
And when I press the showReport button;
raporModel->setQuery("SELECT * FROM tartim WHERE belge_no = '" + belge_no + "' ;");
mRapor->dataManager()->addModel("Tartim", raporModel, true);
mRapor->designReport();
Well, the problem is when I push the showReport button second time it raise error because I wanted to load same model second time. :(
How can I check if the same model name loaded before? Or can I clean the model from dataManeger when I close preview or print the report? Maybe this is better for memoryleak?
P.S: I can not drag the model fields on the report page with mouse! Is it because of the readonly Model?...
Regards,
Mucip:)
-
Hi!
The mistake is here:
mRapor->dataManager()->addModel("Tartim", raporModel, true);
When the third parameter is true it says to limereport that it must get ownership to model
When you try to put the model to datamanager in the second time
it throws the exception (this is my fault i had to prevent this) because datamanager deleted the model because the model is owned him.
In your case, you needn't transfer ownership to limereport you can just set the third parameter to false;
-
Hi,
Thanks. I use "false" parameter than.
But I have one big problem either. I can not drag and drop model field from dataBrowser in Report designer unfortunately. :(
Why?
But I can put text object in dhe band and set it to "$D{tartim.plaka}". Interesting?...
Regards,
Mucip:)
-
It's very strange. Could you make a video?
-
Hi,
Please watch ths video...
https://autode.sk/2PwwYsh
Regards,
Mucip:)
-
Hi,
I guess the error comes from DefaultConnection somehow?! Because only differenc is this with the LimeReportDemo... :(
Regards,
Mucip:)
-
Hi,
Could you watch the video Mr. Arin?
Any feedback?
Regards,
Mucip:)
-
I have watched the video.
I am very surprised.
I try to reproduce the same behavior, but no results.
At your video, i sow that databrowser has no drag and drop behavior.
What OS do you use?
-
Hi,
I connected to SQLite db.
If you really want to see the situation, you may connect me via TemViewer or something else.
If yes, I will send you ID?
Regards,
Mucip:)
-
Say me pleases in my demo drag and drop works as expected?
-
Hi,
Sorry. I didn't understand...
Regards,
Mucip:)
-
Ok, send me TeamViewerID :) I have a little time :)
-
Hi,
I sent you by email...
-
Nop :( Wrong TeamViewer says that password is wrong
-
Hi,
I sent you second...
Please check your email again.