The QPrinterInfo class gives access to information about existing printers. More...
Header: | #include <QPrinterInfo> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS PrintSupport) target_link_libraries(mytarget PRIVATE Qt6::PrintSupport) |
qmake: | QT += printsupport |
QPrinterInfo(const QPrinter &printer) | |
QPrinterInfo(const QPrinterInfo &other) | |
QPrinterInfo() | |
QPrinterInfo & | operator=(const QPrinterInfo &other) |
~QPrinterInfo() | |
QPrinter::ColorMode | defaultColorMode() const |
QPrinter::DuplexMode | defaultDuplexMode() const |
QPageSize | defaultPageSize() const |
QString | description() const |
bool | isDefault() const |
bool | isNull() const |
bool | isRemote() const |
QString | location() const |
QString | makeAndModel() const |
QPageSize | maximumPhysicalPageSize() const |
QPageSize | minimumPhysicalPageSize() const |
QString | printerName() const |
QPrinter::PrinterState | state() const |
QList<QPrinter::ColorMode> | supportedColorModes() const |
QList<QPrinter::DuplexMode> | supportedDuplexModes() const |
QList<QPageSize> | supportedPageSizes() const |
QList<int> | supportedResolutions() const |
bool | supportsCustomPageSizes() const |
QStringList | availablePrinterNames() |
QList<QPrinterInfo> | availablePrinters() |
QPrinterInfo | defaultPrinter() |
QString | defaultPrinterName() |
QPrinterInfo | printerInfo(const QString &printerName) |
Use the static functions to generate a list of QPrinterInfo objects. Each QPrinterInfo object in the list represents a single printer and can be queried for name, supported paper sizes, and whether or not it is the default printer.
Constructs a QPrinterInfo object from printer.
Constructs a copy of other.
Constructs an empty QPrinterInfo object.
See also isNull().
Sets the QPrinterInfo object to be equal to other.
Destroys the QPrinterInfo object. References to the values in the object become invalid.
[static, since 5.3]
QStringList QPrinterInfo::availablePrinterNames()Returns a list of all the available Printer Names on this system.
It is recommended to use this instead of availablePrinters() as it will be faster on most systems.
Note that the list may become outdated if changes are made on the local system or remote print server. Only instantiate required QPrinterInfo instances when needed, and always check for validity before calling.
This function was introduced in Qt 5.3.
[static]
QList<QPrinterInfo>
QPrinterInfo::availablePrinters()Returns a list of QPrinterInfo objects for all the available printers on this system.
It is NOT recommended to use this as creating each printer instance may take a long time, especially if there are remote networked printers, and retained instances may become outdated if changes are made on the local system or remote print server. Use availablePrinterNames() instead and only instantiate printer instances as you need them.
[since 5.13]
QPrinter::ColorMode QPrinterInfo::defaultColorMode() constReturns the default color mode of this printer.
This function was introduced in Qt 5.13.
[since 5.4]
QPrinter::DuplexMode QPrinterInfo::defaultDuplexMode()
constReturns the default duplex mode of this printer.
This function was introduced in Qt 5.4.
[since 5.3]
QPageSize QPrinterInfo::defaultPageSize() constReturns the current default Page Size for this printer.
This function was introduced in Qt 5.3.
[static]
QPrinterInfo QPrinterInfo::defaultPrinter()Returns the default printer on the system.
The return value should be checked using isNull() before being used, in case there is no default printer.
On some systems it is possible for there to be available printers but none of them set to be the default printer.
See also isNull(), isDefault(), and availablePrinters().
[static, since 5.3]
QString QPrinterInfo::defaultPrinterName()Returns the current default printer name.
This function was introduced in Qt 5.3.
[since 5.0]
QString QPrinterInfo::description() constReturns the human-readable description of the printer.
This function was introduced in Qt 5.0.
See also QPrinterInfo::printerName().
Returns whether this printer is currently the default printer.
Returns whether this QPrinterInfo object holds a printer definition.
An empty QPrinterInfo object could result for example from calling defaultPrinter() when there are no printers on the system.
[since 5.3]
bool QPrinterInfo::isRemote() constReturns whether this printer is a remote network printer.
This function was introduced in Qt 5.3.
[since 5.0]
QString QPrinterInfo::location() constReturns the human-readable location of the printer.
This function was introduced in Qt 5.0.
[since 5.0]
QString QPrinterInfo::makeAndModel() constReturns the human-readable make and model of the printer.
This function was introduced in Qt 5.0.
[since 5.3]
QPageSize QPrinterInfo::maximumPhysicalPageSize() constReturns the maximum physical page size supported by this printer.
This function was introduced in Qt 5.3.
See also minimumPhysicalPageSize().
[since 5.3]
QPageSize QPrinterInfo::minimumPhysicalPageSize() constReturns the minimum physical page size supported by this printer.
This function was introduced in Qt 5.3.
See also maximumPhysicalPageSize().
[static, since 5.0]
QPrinterInfo QPrinterInfo::printerInfo(const QString &printerName)Returns the printer printerName.
The return value should be checked using isNull() before being used, in case the named printer does not exist.
This function was introduced in Qt 5.0.
See also isNull().
Returns the name of the printer.
This is a unique id to identify the printer and may not be human-readable.
See also QPrinterInfo::description() and QPrinter::setPrinterName().
[since 5.3]
QPrinter::PrinterState QPrinterInfo::state() constReturns the current state of this printer.
This state may not always be accurate, depending on the platform, printer driver, or printer itself.
This function was introduced in Qt 5.3.
[since 5.13]
QList<QPrinter::ColorMode>
QPrinterInfo::supportedColorModes() constReturns the supported color modes of this printer.
This function was introduced in Qt 5.13.
[since 5.4]
QList<QPrinter::DuplexMode> QPrinterInfo::supportedDuplexModes() constReturns a list of duplex modes supported by this printer.
This function was introduced in Qt 5.4.
[since 5.3]
QList<QPageSize> QPrinterInfo::supportedPageSizes() constReturns a list of Page Sizes supported by this printer.
This function was introduced in Qt 5.3.
[since 5.3]
QList<int> QPrinterInfo::supportedResolutions()
constReturns a list of resolutions supported by this printer.
This function was introduced in Qt 5.3.
[since 5.3]
bool QPrinterInfo::supportsCustomPageSizes() constReturns whether this printer supports custom page sizes.
This function was introduced in Qt 5.3.