Important: Please read the Qt Code of Conduct -

QPrintDialog with custom list of printers

  • Is there a way to pop up a QPrintDialog with a pulldown menu consisting of a custom list of printers?

    By default, it appears that QPrintDialog comes up with a list of printers generated from QPinterInfo.availablePrinters(). This in turn (I think) gets its list of printers from the /etc/printcap file created by CUPS on linux systems.

    Unfortunately, at my lab, the machines that I run my applications on are all CUPS clients and not the server themselves, and so the printcap file never gets generated locally and the printers don't show up in Qt. Its possible that there's a workaround for this as well in Qt, but I haven't been able to figure one out yet.

    From the terminal, "lpstat -a" shows all of the available printers on the network properly, and so my idea was to simply use this to generate the list of printers and pass that to the dialog for the pulldown, but I'm not sure how to override that widget for this. I'd really rather not re-invent the wheel by making a whole new custom widget.

    Any ideas would be most appreciated. Thanks!

    OS: Red Hat Linux 5
    Qt: 4.8.5
    Python: 2.7.4
    PyQt: 4.10.1
    SIP: 4.14.7

Log in to reply