February 22, 2012

Kewal Kewal
Lab Rat
16 posts

Detecting a printer connection


I was trying to find the printer state, though QPrinter provides QPrinter::printerState
Returns the current state of the printer. This may not always be accurate (for example if the printer doesn’t have the capability of reporting its state to the operating system).

is there any way to monitor the printer when it is connected and disconnected and receive events in the application?

3 replies

February 24, 2012

Blizzard Blizzard
Lab Rat
65 posts

printerState returns the state of the printer, as you said.

QPrinter::Idle 0
QPrinter::Active 1
QPrinter::Aborted 2
QPrinter::Error 3

You can just set up a signal that checks if the printer is active or not based on the above chart, which could then trigger your events.


Software Engineer | Aerospace & Defence

June 22, 2013

guru guru
Lab Rat
49 posts

is this possible to detect a thermal printer?

June 26, 2013

mlong mlong
Robot Herder
1537 posts

is this possible to detect a thermal printer?

This really goes beyond the scope of Qt. Qt will happily work with any printer that is configured on your system, but I’m not aware of any way to detect the specifics of whether a printer is a thermal printer or not.

However, if you have a thermal printer configured already, you can print to it from Qt.


Senior Software Engineer
AccuWeather Enterprise Solutions
/* My views and opinions do not necessarily reflect those of my employer.  Void where prohibited. */

  ‹‹ Unpredictable crashes with QThread/QtConcurrent on Linux (same application working on Windows)      Qt Application with CLI Commands ››

You must log in to post a reply. Not a member yet? Register here!