Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
QPrintDialog with custom list of printers
Atropos last edited by
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