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
printer.setPrinterName("DYMO LabelWriter 450");
qDebug() << "printer valid? " << printer.isValid(); // comes back false
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
To copy to clipboard, switch view to plain text mode
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?
Bookmarks