QPainter.begin returns false on prod machine
-
I think thats a dependency problem, anyhow.
Are you using windeployqt.exe tool ?
If not look here : http://doc.qt.io/qt-5/windows-deployment.html
To check wether there are dlls missing you can use DependencyWalker : http://www.dependencywalker.com/
-
Thansk, I am not using windeployqt.exe, I am gonna have a look.
Anyway I do use DependencyWalker, and that's the problem : it doesn't give me any wrong feedback, all is green...
I have even tried to copy all the Qt dlls into my app folder (hardcore attempt when you suspect that you are missing a dll), but nothing changed.
-
@PierreFIL
make sure the printer plugins are found and successfully loaded.
Set QT_DEBUG_PLUGINS env variable to a non-zero and check the console output.
Note: plugins are searched in special-named folders. -
The only plugin that seems to be used is windowsprintersupport.dll, and it's correctly loaded from the special-named folder "printsupport"
-
I dont think this a QPrinter problem but more a QPainter problem.
As a notice you don't need any printers to be installed on your prod machine.
You want to write to an PDF file and not print the resulting document. Is this right ?Try deploying the imageformats that windeployqt.exe gives you.
-
Correct, this is what I want it to do.
I tried to use the deploying tool, so I got imageformats dlls + other files added ( some files.qm, D3Dcompiler46.dll, accessible and iconengines folders containing other dlls...), but it doesn't solve the problem.
-
I found part of the problem :
Executing the application with user Windows session fails, BUT executing it with admin session works...
Now I have to understand why, and how to fix that. Looks like the lambda user session can't access any printer from Qt.
-
When I do this I use code like this...
printer->newPage(); QPainter l_oPainter(&l_oPrinter); ui.wdg_All->render(...);
I think the newPage() line would also work just before the call to render.
Painter and printer then goes out of scope in my code. How about yours, does this not work for you? -
OK, so now that I have launched the program with admin rights and came back with user session, the application is working (?!?)
So it was neither a DLL or plugins problem, but just a weird right access blocking. I am sad I can't explain why I had to launch it once with admin session, but at least I am glad I solved my problem.
Thanks anyway to those who give their time to help.