Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPrintDialog cannot be used on non-native printers Mac OS
Forum Updated to NodeBB v4.3 + New Features

QPrintDialog cannot be used on non-native printers Mac OS

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 5.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mourad_bilog
    wrote on last edited by mourad_bilog
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What printer is that ? How did you install it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • M Offline
        M Offline
        mourad_bilog
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          How did you setup that printer ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • SGaistS SGaist

            How did you setup that printer ?

            M Offline
            M Offline
            mourad_bilog
            wrote on last edited by
            #5

            @SGaist From Prefences --> Printer, I've searched it on our network and I find it.

            Doe's any driver is required ?

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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();
                      }
              }
              
              M 1 Reply Last reply
              1
              • mrjjM mrjj

                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();
                        }
                }
                
                M Offline
                M Offline
                mourad_bilog
                wrote on last edited by
                #7

                @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.

                1 Reply Last reply
                0
                • mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Hi
                  And the printer was installed the same way on both system ?

                  M 1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    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.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    1
                    • mrjjM mrjj

                      Hi
                      And the printer was installed the same way on both system ?

                      M Offline
                      M Offline
                      mourad_bilog
                      wrote on last edited by
                      #10

                      @mrjj yes.

                      1 Reply Last reply
                      0
                      • SGaistS SGaist

                        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.

                        M Offline
                        M Offline
                        mourad_bilog
                        wrote on last edited by
                        #11

                        @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 ?

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          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 !

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          M 1 Reply Last reply
                          1
                          • SGaistS SGaist

                            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 !

                            M Offline
                            M Offline
                            mourad_bilog
                            wrote on last edited by
                            #13

                            @SGaist Yes, the problem is solved with Qt5.10. Many thanks

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved