Question

I am updating the printer list using availablePrinters(). But it fails to list the new printer added while running application. It is working fine with Qt 4.

The code can be seen below:

#include <QCoreApplication>
#include <QtPrintSupport/QPrinterInfo>
#include <QThread>
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    while (1) {
        QThread::msleep(3000);
        qDebug()<<"List of printers";
        QList<QPrinterInfo> printerList=QPrinterInfo::availablePrinters();
        foreach (QPrinterInfo printerInfo, printerList) {
            qDebug()<<printerInfo.printerName();
        }

    }
    return a.exec();
}
Was it helpful?

Solution

That was a bug with the existing Qt version, and It got fixed on the next version

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top