I'm experiencing Qt4 to Qt5 troubles. In my application when the user clicks the print button two things should happen, one is that a PDF gets written to disk (which still works fine in the new version, so I know that some of the printing functions are working properly) and the other is that a QPrintDialog should exec() and then send to a connected printer.
I see the dialog when I launch from my development machine. The application launches on the deployed machine, but the QPrintDialog never shows and the document never prints.
I am including print support.
QT += core gui network webkitwidgets widgets printsupport
I have been using Process Explorer to see what DLLs the application uses on my development machine, and I believe that everything is present. My application bundle includes:
The following is the relevant code snippet:
void PrintableForm::printFile()
{
//Writes the PDF to disk in every environment
pdfCopy();
//Paper Copy only works on my dev machine
QPrinter paperPrinter;
QPrintDialog printDialog(&paperPrinter,this);
if( printDialog.exec() == QDialog::Accepted ) {
view->print(&paperPrinter);
}
this->accept();
}
My first thought is that the relevant DLLs are not being found come print time, and that means that my application file system is incorrect, but I have not found anything that shows me a different file structure. Am I on the right track or is there something else wrong with this setup?
This was another classic Windows/Qt5 deployment problem with a combination of missing plugins and plugins placed in incorrect places. By using the environmental variable QT_DEBUG_PLUGIN and adding CONFIG += CONSOLE to my PRO file I was able to see that on my development machine the application was loading qminimal.dll which I was not shipping.
The application root which I have defined as {myAppPath}\ is the root directory for plugins. Therefore the correct file structure is:
Thanks peppe for the lead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With