9#include <qpa/qplatformprintplugin.h>
10#include <qpa/qplatformprintersupport.h>
17#include <private/qpagedpaintdevice_p.h>
22#if QT_CONFIG(printpreviewwidget)
23#include <private/qpaintengine_preview_p.h>
30#define ABORT_IF_ACTIVE(location) \
31 if (d->printEngine->printerState() == QPrinter::Active) { \
32 qWarning("%s: Cannot be changed while printer is active", location); \
36#define ABORT_IF_ACTIVE_RETURN(location, retValue) \
37 if (d->printEngine->printerState() == QPrinter::Active) { \
38 qWarning("%s: Cannot be changed while printer is active", location); \
49 if (printerToUse.
isNull()) {
51 if (printerToUse.
isNull()) {
53 if (!availablePrinterNames.isEmpty())
71 if (ps && !printerToUse.
isNull()) {
104 if (oldPrintEngine) {
121 delete oldPrintEngine;
124#if QT_CONFIG(printpreviewwidget)
128 return previewEngine->pages();
132void QPrinterPrivate::setPreviewMode(
bool enable)
142 q->setEngines(previewEngine, previewEngine);
174 qWarning(
"QPrinter::setPageLayout: Cannot be changed while printer is active");
190 qWarning(
"QPrinter::setPageLayout: Cannot be changed while printer is active");
463 qFatal(
"QPrinter: Must construct a QCoreApplication before a QPrinter");
491 if (
d->use_default_engine)
492 delete d->printEngine;
496 d->use_default_engine =
false;
507 if (
d->use_default_engine)
508 delete d->printEngine;
509#if QT_CONFIG(printpreviewwidget)
510 delete d->previewEngine;
553 if (!printerToUse.
isNull())
554 d->changeEngines(
format, printerToUse);
568 return d->outputFormat;
582 if (
d->pdfVersion == version)
585 d->pdfVersion = version;
600 return d->pdfVersion;
641 if (
name.isEmpty()) {
647 if (printerToUse.
isNull())
674 return d->validPrinter;
1190 return d->printEngine->metric(
id);
1199 return d->paintEngine;
1210 return d->printEngine;
1228 for (
const auto &
var : varlist)
1246 return d->printEngine->newPage();
1261 return d->printEngine->abort();
1272 return d->printEngine->printerState();
1275#if defined(Q_OS_WIN) || defined(Q_QDOC)
1295 for (
const auto &
variant : variant_list)
1442 return d->printRange;
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
\inmodule QtCore \reentrant
QString suffix() const
Returns the suffix (extension) of the file.
qsizetype size() const noexcept
QList< T > toList() const noexcept
void reserve(qsizetype size)
QRectF fullRect() const
Returns the full page rectangle in the current layout units.
bool isEquivalentTo(const QPageLayout &other) const
Returns true if this page layout is equivalent to the other page layout, i.e.
Unit units() const
Returns the units the page layout is currently defined in.
QRectF paintRect() const
Returns the page rectangle in the current layout units.
Unit
This enum type is used to specify the measurement unit for page layout and margins.
QMarginsF margins() const
Returns the margins of the page layout using the currently set units.
Orientation orientation() const
Returns the page orientation of the page layout.
QRect paintRectPixels(int resolution) const
Returns the paintable rectangle in rounded device pixels for the given resolution.
Orientation
This enum type defines the page orientation.
QRect fullRectPixels(int resolution) const
Returns the full page rectangle in device pixels for the given resolution.
QPageSize pageSize() const
Returns the page size of the page layout.
bool isEquivalentTo(const QPageSize &other) const
Returns true if this page is equivalent to the other page, i.e.
QPageLayout pageLayout() const
QPagedPaintDevicePrivate * d
PdfVersion
The PdfVersion enum describes the version of the PDF file that is produced by QPrinter or QPdfWriter.
virtual Type type() const =0
Reimplement this function to return the paint engine \l{Type}.
virtual QPrinter::PrinterState printerState() const =0
Returns the current state of the printer being used by the print engine.
virtual void setProperty(PrintEnginePropertyKey key, const QVariant &value)=0
Sets the print engine's property specified by key to the given value.
virtual QVariant property(PrintEnginePropertyKey key) const =0
Returns the print engine's property specified by key.
PrintEnginePropertyKey
This enum is used to communicate properties between the print engine and QPrinter.
@ PPK_SupportedResolutions
@ PPK_SupportsMultipleCopies
The QPrinterInfo class gives access to information about existing printers.
bool isNull() const
Returns whether this QPrinterInfo object holds a printer definition.
QString printerName() const
Returns the name of the printer.
static QStringList availablePrinterNames()
Returns a list of all the available Printer Names on this system.
static QPrinterInfo defaultPrinter()
Returns the default printer on the system.
static QPrinterInfo printerInfo(const QString &printerName)
Returns the printer printerName.
bool setPageLayout(const QPageLayout &newPageLayout) override
bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
virtual ~QPrinterPagedPaintDevicePrivate()
QPageLayout pageLayout() const override
QPrinterPagedPaintDevicePrivate(QPrinter *p)
bool setPageOrientation(QPageLayout::Orientation orientation) override
bool setPageSize(const QPageSize &pageSize) override
QPrinterInfo findValidPrinter(const QPrinterInfo &printer=QPrinterInfo())
QPrinter::PdfVersion pdfVersion
void initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer)
QPrinter::OutputFormat outputFormat
QPrinter::PrinterMode printerMode
QSet< QPrintEngine::PrintEnginePropertyKey > m_properties
QPrintEngine * printEngine
void init(const QPrinterInfo &printer, QPrinter::PrinterMode mode)
QPaintEngine * realPaintEngine
QPaintEngine * paintEngine
void changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer)
QPrintEngine * realPrintEngine
void setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value)
static QPrinterPrivate * get(QPrinter *printer)
QRectF paperRect(Unit) const
bool supportsMultipleCopies() const
void setFontEmbeddingEnabled(bool enable)
PdfVersion pdfVersion() const
QString creator() const
Returns the name of the application that created the document.
QPrintEngine * printEngine() const
DuplexMode duplex() const
void setPrintRange(PrintRange range)
int metric(PaintDeviceMetric) const override
QRectF pageRect(Unit) const
bool fontEmbeddingEnabled() const
bool newPage() override
Tells the printer to eject the current page and to continue printing on a new page.
void setPrinterSelectionOption(const QString &)
Sets the printer to use option to select the printer.
PaperSource
This enum type specifies what paper source QPrinter is to use.
void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine)
This function is used by subclasses of QPrinter to specify custom print and paint engines (printEngin...
void setPrintProgram(const QString &)
Sets the name of the program that should do the print job to printProg.
void setPaperSource(PaperSource)
Sets the paper source setting to source.
void setCollateCopies(bool collate)
QString printProgram() const
Returns the name of the program that sends the print output to the printer.
void setPdfVersion(PdfVersion version)
ColorMode colorMode() const
Returns the current color mode.
OutputFormat
The OutputFormat enum is used to describe the format QPrinter should use for printing.
int devType() const override
QPaintEngine * paintEngine() const override
Returns the paint engine used by the printer.
void setOutputFormat(OutputFormat format)
ColorMode
This enum type is used to indicate whether QPrinter should print in color or not.
QList< int > supportedResolutions() const
Returns a list of the resolutions (a list of dots-per-inch integers) that the printer says it support...
QString docName() const
Returns the document name.
int resolution() const
Returns the current assumed resolution of the printer, as set by setResolution() or by the printer dr...
void setDuplex(DuplexMode duplex)
void setFullPage(bool)
If fp is true, enables support for painting over the entire page; otherwise restricts painting to the...
void setColorMode(ColorMode)
Sets the printer's color mode to newColorMode, which can be either Color or GrayScale.
PaperSource paperSource() const
Returns the printer's paper source.
QString outputFileName() const
Returns the name of the output file.
void setFromTo(int fromPage, int toPage)
PrinterMode
This enum describes the mode the printer should work in.
PrintRange printRange() const
bool abort()
Aborts the current print run.
void setOutputFileName(const QString &)
Sets the name of the output file to fileName.
bool fullPage() const
Returns true if the origin of the printer's coordinate system is at the corner of the page and false ...
PrinterState
\value Idle \value Active \value Aborted \value Error
PrinterState printerState() const
Returns the current state of the printer.
QPrinter(PrinterMode mode=ScreenResolution)
Creates a new printer object with the given mode.
QString printerName() const
Returns the printer name.
void setDocName(const QString &)
Sets the document name to name.
void setCreator(const QString &)
Sets the name of the application that created the document to creator.
PageOrder
This enum type is used by QPrinter to tell the application program how to print.
void setPageOrder(PageOrder)
Sets the page order to pageOrder.
PrintRange
Used to specify the print range selection option.
QString printerSelectionOption() const
Returns the printer options selection string.
OutputFormat outputFormat() const
bool collateCopies() const
void setPrinterName(const QString &)
Sets the printer name to name.
void setResolution(int)
Requests that the printer prints at dpi or as near to dpi as possible.
~QPrinter()
Destroys the printer object and frees any allocated resources.
PageOrder pageOrder() const
Returns the current page order.
\inmodule QtCore\reentrant
iterator insert(const T &value)
\macro QT_RESTRICTED_CAST_FROM_ASCII
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Combined button and popup list for selecting options.
std::pair< T1, T2 > QPair
static const QCssKnownValue properties[NumProperties - 1]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
GLdouble GLdouble GLdouble GLdouble q
constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
#define ABORT_IF_ACTIVE(location)
qreal qt_pixelMultiplier(int resolution)
static int toInt(const QChar &qc, int R)
QFileInfo fi("c:/temp/foo")
[newstuff]
QItemEditorCreatorBase * creator