Solved QPrintDialog cannot be used on non-native printers Mac OS
-
Hello everybody,
The following error occurs when I try to print a document on an installed printer on Mac OS 10.13 (it works fine on Mac OS 10.10) with Qt 5.5.
QPrintDialog : cannot be used on non-native printers
There's my source code :
QPrinter *printer = new QPrinter(QPrinter::HighResolution); printer->setOutputFormat(QPrinter::NativeFormat); printer->setPageSize(QPrinter::A4); printer->setOrientation(QPrinter::Portrait); printer->setFullPage(true); doc->setUseDesignMetrics(true); doc->documentLayout()->setPaintDevice(printer); QFont f(doc->defaultFont()); f.setPointSize(10); doc->setDefaultFont(f); QPrintDialog printDialog(printer, this); if (printDialog.exec() == QDialog::Accepted) { doc->print_ListOrdo(printer); valider(); }
and I'm including printsupport to my .pro file :
TEMPLATE = app TARGET = Autonome QT += core gui network sql xml printsupport widgets LIBS += -framework CoreFoundation LIBS += -framework IOKit LIBS += -framework SystemConfiguration QTPLUGIN += cocoaprintersupport macx { # Build against latest platform SDK, deployable on OS X 10.8 QMAKE_MAC_SDK = macosx10.11 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11 }
Can anyone tell me what wrong and how to fix this problem.
Many thanks for your precious help.
Best regards -
Hi,
What printer is that ? How did you install it ?
-
Thanks for replying.
It's a Canon MF210 printer accessed by the network.
Note that I've printed other document from the Mac OS using this printer.
-
How did you setup that printer ?
-
@SGaist From Prefences --> Printer, I've searched it on our network and I find it.
Doe's any driver is required ?
-
Hi
Im wondering if Qt even sees it.
Have you tried to dump the printers it sees ?#include <QtPrintSupport/QPrinterInfo> #include <QDebug> int main(int argc, char *argv[]) { qDebug()<<"List of printers"; QList<QPrinterInfo> printerList=QPrinterInfo::availablePrinters(); foreach (QPrinterInfo printerInfo, printerList) { qDebug()<<printerInfo.printerName(); } }
-
@mrjj Thanks for replying.
I've integread this code but nothing is displayed and still the same error. The printer is not seen by the Qt Application on Mac OS 10.13 (prod envrionnement) but it see in the dev environment (Mac OS 10.10).
Also, I can print document from other application on the Mac OS 10.13.
I don't see where's the problem in my code or it is installation problem.
-
Hi
And the printer was installed the same way on both system ? -
Did you try to use a more recent version of Qt on your prod environment ? Qt 5.5 is pretty old compared to macOS 10.13.
-
@mrjj yes.
-
@SGaist Do you mean I deploy Qt 5.10 Frameworks and libraries on the prod envirement ? That could'nt cause any problem with the other plugings and libraries such as firebird driver ?
-
No, not at all. I mean, create a bundle for your application (or rather a lighter version just to check the printing support) using macdeployqt and run that.
Don't modify your production environment !
-
@SGaist Yes, the problem is solved with Qt5.10. Many thanks