K4ELO
22nd November 2013, 13:43
Running Qt under Windows and for some reason it can't find the printers (there are 7 including both network and usb printers).
Here's the relevant code:
QT += sql \
printsupport \
serialport \
xml \
network \
widgets
from mainwindow.h
#include <QPrinter>
#include <QPrintDialog>
#include <QPrinterInfo>
from mainwindow.cpp
QList <QPrinterInfo> plist = QPrinterInfo::availablePrinters();
qDebug() << "len = " << plist.length(); // len comes back zero
QPrinter printer;
printer.setPrinterName("DYMO LabelWriter 450");
qDebug() << "printer valid? " << printer.isValid(); // comes back false
I have another application that uses the same code and it reports 7 printers and prints to the Dymo just fine.
Any idea what I am missing here?
Here's the relevant code:
QT += sql \
printsupport \
serialport \
xml \
network \
widgets
from mainwindow.h
#include <QPrinter>
#include <QPrintDialog>
#include <QPrinterInfo>
from mainwindow.cpp
QList <QPrinterInfo> plist = QPrinterInfo::availablePrinters();
qDebug() << "len = " << plist.length(); // len comes back zero
QPrinter printer;
printer.setPrinterName("DYMO LabelWriter 450");
qDebug() << "printer valid? " << printer.isValid(); // comes back false
I have another application that uses the same code and it reports 7 printers and prints to the Dymo just fine.
Any idea what I am missing here?