Results 1 to 3 of 3

Thread: QPrinter constructor ignores QPrinterInfo parameter

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QPrinter constructor ignores QPrinterInfo parameter

    @ChrisW67
    Thanks for your hints, how to approach the problem. My extended code snipet now looks as follows:
    Qt Code:
    1. printerInfo = QPrinterInfo::printerInfo(QStringLiteral("Farbdrucker"));
    2. qDebug() << "printer selected in printerInfo:" << (printerInfo.isNull() ? tr("not set") : tr("%1 (%2)").arg(printerInfo.printerName()).arg(printerInfo.description()));
    3. QPrinter* printer = new QPrinter(printerInfo /*, QPrinter::HighResolution*/);
    4. qDebug() << "selected printer" << printer->printerName();
    5. QPainter testPainter;
    6. testPainter.begin(printer);
    7. printer->newPage();
    8. testPainter.end();
    To copy to clipboard, switch view to plain text mode 
    • The color printer is connected and other applications are able to print to it.
    • It attempts to print to the system-wide default printer TLP2742.

    When I select a different printer as system wide default, e.g., print-to-pdf, then the code snipet works properly! Thus, it seems that the issue is specifically with the printer TLP2742 (an offline printer, i.e., it should print to a file). I will further look into this and report back. (I still consider it unexpected behavior / bug that a potentially misconfigured printer TLP2742 messes up the printer selection in a Qt program that deliberately avoids to print to the TLP2742).

    [EDIT]
    I can now confirm that the issue is related to the driver for the default printer that is incomplete or broken. Still not good, of course: this means that an end-user error outside of my control has the potential to break some functionality of my Qt application.
    Last edited by Al_; 27th December 2014 at 15:47.

Similar Threads

  1. Replies: 3
    Last Post: 7th April 2014, 09:43
  2. Replies: 10
    Last Post: 16th September 2013, 11:03
  3. QPrinterInfo - is it possible to recognize a plotter?
    By guest9999 in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2013, 21:40
  4. Replies: 4
    Last Post: 12th August 2008, 01:55
  5. Replies: 2
    Last Post: 24th July 2008, 20:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.