I'm trying to get the name of the current printer using the libcups library in Linux, but I can't find such a method. I found only how to get a complete list of printers, but how to find out which one will print is not clear.
#include <cups/cups.h>
QStringList getPrinters()
{
QStringList printerNames;
cups_dest_t *dests;
int num_dests = cupsGetDests(&dests);
for (int pr = 0; pr < num_dests; ++pr) {
QString printerName = QString::fromUtf8(dests[pr].name);
printerNames.append(printerName);
}
cupsFreeDests(num_dests, dests);
return printerNames;
}