Reputation: 8303
I'm using Qt for a project (Qt 5.0.2, precompiled and downloaded from qt-project.org) on Windows 7 (32-bit) and I'm having trouble trying to print a document.
qDebug() << QPrinterInfo::availablePrinters().size(); // 0
I'm able to print as PDF and I tested the same executable in other computers, it works just well. I do have printers installed and I can print normally from any other program such as notepad or Word. Any clue on why is it returning an empty list? I can't find this behavior documented anywhere, is this a Qt bug?
Upvotes: 5
Views: 2076
Reputation: 161
When you deploy your Qt application, you should put
[your Qt application]\printsupport\windowsprintersupport.dll
The library windowsprintersupport.dll should be taken from
[Qt path]\[platform]\plugins\printsupport
P.S. The first answer is almost correct, except path's names.
Upvotes: 8
Reputation: 40502
May be your application cannot find plugins which allow printing facilities (printingsupport directory must be in execution directory from qt the bin\plugins directory).
This answer is moved from AnatolyS' comment.
Upvotes: -2