Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qprinter.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qprinter.h"
5#include "qprinter_p.h"
6
7#ifndef QT_NO_PRINTER
8
9#include <qpa/qplatformprintplugin.h>
10#include <qpa/qplatformprintersupport.h>
11
12#include "qprintengine.h"
13#include "qlist.h"
14#include <qcoreapplication.h>
15#include <qfileinfo.h>
16
17#include <private/qpagedpaintdevice_p.h>
18
19#include "qprintengine_pdf_p.h"
20
21#include <qpicture.h>
22#if QT_CONFIG(printpreviewwidget)
23#include <private/qpaintengine_preview_p.h>
24#endif
25
27
28using namespace Qt::StringLiterals;
29
30#define ABORT_IF_ACTIVE(location) \
31 if (d->printEngine->printerState() == QPrinter::Active) { \
32 qWarning("%s: Cannot be changed while printer is active", location); \
33 return; \
34 }
35
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); \
39 return retValue; \
40 }
41
42extern qreal qt_pixelMultiplier(int resolution);
43extern QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits);
44
46{
47 // Try find a valid printer to use, either the one given, the default or the first available
48 QPrinterInfo printerToUse = printer;
49 if (printerToUse.isNull()) {
50 printerToUse = QPrinterInfo::defaultPrinter();
51 if (printerToUse.isNull()) {
52 QStringList availablePrinterNames = QPrinterInfo::availablePrinterNames();
53 if (!availablePrinterNames.isEmpty())
54 printerToUse = QPrinterInfo::printerInfo(availablePrinterNames.at(0));
55 }
56 }
57 return printerToUse;
58}
59
61{
62 // Default to PdfFormat
64 QPlatformPrinterSupport *ps = nullptr;
65 QString printerName;
66
67 // Only set NativeFormat if we have a valid plugin and printer to use
70 QPrinterInfo printerToUse = findValidPrinter(printer);
71 if (ps && !printerToUse.isNull()) {
73 printerName = printerToUse.printerName();
74 }
75 }
76
80 } else {
85 };
86 const auto pdfEngineVersion = engineMapping.value(pdfVersion, QPdfEngine::Version_1_4);
87 QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode, pdfEngineVersion);
88 paintEngine = pdfEngine;
89 printEngine = pdfEngine;
90 }
91
92 use_default_engine = true;
94 validPrinter = true;
95}
96
98{
99 QPrintEngine *oldPrintEngine = printEngine;
100 const bool def_engine = use_default_engine;
101
102 initEngines(format, printer);
103
104 if (oldPrintEngine) {
105 const auto properties = m_properties; // take a copy: setProperty() below modifies m_properties
106 for (const auto &key : properties) {
107 QVariant prop;
108 // PPK_NumberOfCopies need special treatmeant since it in most cases
109 // will return 1, disregarding the actual value that was set
110 // PPK_PrinterName also needs special treatment as initEngines has set it already
112 prop = QVariant(q_ptr->copyCount());
114 prop = oldPrintEngine->property(key);
115 if (prop.isValid())
116 setProperty(key, prop);
117 }
118 }
119
120 if (def_engine)
121 delete oldPrintEngine;
122}
123
124#if QT_CONFIG(printpreviewwidget)
125QList<const QPicture *> QPrinterPrivate::previewPages() const
126{
127 if (previewEngine)
128 return previewEngine->pages();
130}
131
132void QPrinterPrivate::setPreviewMode(bool enable)
133{
134 Q_Q(QPrinter);
135 if (enable) {
136 if (!previewEngine)
137 previewEngine = new QPreviewPaintEngine;
139 use_default_engine = false;
142 q->setEngines(previewEngine, previewEngine);
143 previewEngine->setProxyEngines(realPrintEngine, realPaintEngine);
144 } else {
145 q->setEngines(realPrintEngine, realPaintEngine);
147 }
148}
149#endif // QT_CONFIG(printpreviewwidget)
150
152{
155}
156
157
159{
160public:
163 {}
164
166 {}
167
168 bool setPageLayout(const QPageLayout &newPageLayout) override
169 {
171
174 qWarning("QPrinter::setPageLayout: Cannot be changed while printer is active");
175 return false;
176 }
177
178 // Try to set the print engine page layout
180
181 return pageLayout().isEquivalentTo(newPageLayout);
182 }
183
184 bool setPageSize(const QPageSize &pageSize) override
185 {
187
190 qWarning("QPrinter::setPageLayout: Cannot be changed while printer is active");
191 return false;
192 }
193
194
195 // Try to set the print engine page size
197
198 return pageLayout().pageSize().isEquivalentTo(pageSize);
199 }
200
202 {
204
205 // Set the print engine value
207
208 return pageLayout().orientation() == orientation;
209 }
210
211 bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
212 {
214
215 // Try to set print engine margins
218
219 return pageLayout().margins() == margins && pageLayout().units() == units;
220 }
221
222 QPageLayout pageLayout() const override
223 {
225
226 return qvariant_cast<QPageLayout>(pd->printEngine->property(QPrintEngine::PPK_QPageLayout));
227 }
228
230};
231
232
443 d_ptr(new QPrinterPrivate(this))
444{
445 d_ptr->init(QPrinterInfo(), mode);
446}
447
455 d_ptr(new QPrinterPrivate(this))
456{
457 d_ptr->init(printer, mode);
458}
459
461{
463 qFatal("QPrinter: Must construct a QCoreApplication before a QPrinter");
464 return;
465 }
466
468
470}
471
487void QPrinter::setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine)
488{
489 Q_D(QPrinter);
490
491 if (d->use_default_engine)
492 delete d->printEngine;
493
494 d->printEngine = printEngine;
495 d->paintEngine = paintEngine;
496 d->use_default_engine = false;
497}
498
505{
506 Q_D(QPrinter);
507 if (d->use_default_engine)
508 delete d->printEngine;
509#if QT_CONFIG(printpreviewwidget)
510 delete d->previewEngine;
511#endif
512}
513
545{
546 Q_D(QPrinter);
547
548 if (d->outputFormat == format)
549 return;
550
552 QPrinterInfo printerToUse = d->findValidPrinter();
553 if (!printerToUse.isNull())
554 d->changeEngines(format, printerToUse);
555 } else {
556 d->changeEngines(format, QPrinterInfo());
557 }
558}
559
566{
567 Q_D(const QPrinter);
568 return d->outputFormat;
569}
570
579{
580 Q_D(QPrinter);
581
582 if (d->pdfVersion == version)
583 return;
584
585 d->pdfVersion = version;
586
587 if (d->outputFormat == QPrinter::PdfFormat) {
588 d->changeEngines(d->outputFormat, QPrinterInfo());
589 }
590}
591
598{
599 Q_D(const QPrinter);
600 return d->pdfVersion;
601}
602
606{
607 return QInternal::Printer;
608}
609
617{
618 Q_D(const QPrinter);
619 return d->printEngine->property(QPrintEngine::PPK_PrinterName).toString();
620}
621
634{
635 Q_D(QPrinter);
636 ABORT_IF_ACTIVE("QPrinter::setPrinterName");
637
638 if (printerName() == name)
639 return;
640
641 if (name.isEmpty()) {
643 return;
644 }
645
647 if (printerToUse.isNull())
648 return;
649
651 d->changeEngines(QPrinter::NativeFormat, printerToUse);
652 } else {
653 d->setProperty(QPrintEngine::PPK_PrinterName, name);
654 }
655}
656
670{
671 Q_D(const QPrinter);
672 if (!qApp)
673 return false;
674 return d->validPrinter;
675}
676
688{
689 Q_D(const QPrinter);
690 return d->printEngine->property(QPrintEngine::PPK_OutputFileName).toString();
691}
692
713{
714 Q_D(QPrinter);
715 ABORT_IF_ACTIVE("QPrinter::setOutputFileName");
716
718 if (!fi.suffix().compare("pdf"_L1, Qt::CaseInsensitive))
720 else if (fileName.isEmpty())
722
724}
725
726
739{
740 Q_D(const QPrinter);
741 return d->printEngine->property(QPrintEngine::PPK_PrinterProgram).toString();
742}
743
744
754void QPrinter::setPrintProgram(const QString &printProg)
755{
756 Q_D(QPrinter);
757 ABORT_IF_ACTIVE("QPrinter::setPrintProgram");
758 d->setProperty(QPrintEngine::PPK_PrinterProgram, printProg);
759}
760
761
768{
769 Q_D(const QPrinter);
770 return d->printEngine->property(QPrintEngine::PPK_DocumentName).toString();
771}
772
773
785{
786 Q_D(QPrinter);
787 ABORT_IF_ACTIVE("QPrinter::setDocName");
789}
790
791
798{
799 Q_D(const QPrinter);
800 return d->printEngine->property(QPrintEngine::PPK_Creator).toString();
801}
802
803
815{
816 Q_D(QPrinter);
817 ABORT_IF_ACTIVE("QPrinter::setCreator");
818 d->setProperty(QPrintEngine::PPK_Creator, creator);
819}
820
835{
837
838 Q_D(QPrinter);
839 ABORT_IF_ACTIVE("QPrinter::setPageOrder");
841}
842
843
851{
852 Q_D(const QPrinter);
853 return QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt());
854}
855
856
865{
866 Q_D(QPrinter);
867 ABORT_IF_ACTIVE("QPrinter::setColorMode");
868 d->setProperty(QPrintEngine::PPK_ColorMode, newColorMode);
869}
870
871
878{
879 Q_D(const QPrinter);
880 return QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt());
881}
882
895{
896 Q_D(QPrinter);
897 ABORT_IF_ACTIVE("QPrinter::setCopyCount;");
898 d->setProperty(QPrintEngine::PPK_CopyCount, count);
899}
900
910{
911 Q_D(const QPrinter);
912 return d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt();
913}
914
930{
931 Q_D(const QPrinter);
932 return d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool();
933}
934
947{
948 Q_D(const QPrinter);
949 return d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool();
950}
951
952
964{
965 Q_D(QPrinter);
966 ABORT_IF_ACTIVE("QPrinter::setCollateCopies");
967 d->setProperty(QPrintEngine::PPK_CollateCopies, collate);
968}
969
970
971
994{
995 Q_D(QPrinter);
996 // Set the print engine
997 d->setProperty(QPrintEngine::PPK_FullPage, fp);
998}
999
1000
1012{
1013 Q_D(const QPrinter);
1014 return d->printEngine->property(QPrintEngine::PPK_FullPage).toBool();
1015}
1016
1017
1032{
1033 Q_D(QPrinter);
1034 ABORT_IF_ACTIVE("QPrinter::setResolution");
1035 d->setProperty(QPrintEngine::PPK_Resolution, dpi);
1036}
1037
1038
1047{
1048 Q_D(const QPrinter);
1049 return d->printEngine->property(QPrintEngine::PPK_Resolution).toInt();
1050}
1051
1062{
1063 Q_D(QPrinter);
1064 d->setProperty(QPrintEngine::PPK_PaperSource, source);
1065}
1066
1072{
1073 Q_D(const QPrinter);
1074 return QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt());
1075}
1076
1077
1086{
1087 Q_D(QPrinter);
1089}
1090
1099{
1100 Q_D(const QPrinter);
1101 return d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool();
1102}
1103
1130{
1131 Q_D(QPrinter);
1132 d->setProperty(QPrintEngine::PPK_Duplex, duplex);
1133}
1134
1143{
1144 Q_D(const QPrinter);
1145 return static_cast <DuplexMode> (d->printEngine->property(QPrintEngine::PPK_Duplex).toInt());
1146}
1147
1158{
1159 if (unit == QPrinter::DevicePixel)
1161 else
1162 return pageLayout().paintRect(QPageLayout::Unit(unit));
1163}
1164
1165
1175{
1176 if (unit == QPrinter::DevicePixel)
1178 else
1179 return pageLayout().fullRect(QPageLayout::Unit(unit));
1180}
1181
1188{
1189 Q_D(const QPrinter);
1190 return d->printEngine->metric(id);
1191}
1192
1197{
1198 Q_D(const QPrinter);
1199 return d->paintEngine;
1200}
1201
1208{
1209 Q_D(const QPrinter);
1210 return d->printEngine;
1211}
1212
1222{
1223 Q_D(const QPrinter);
1224 const QList<QVariant> varlist
1225 = d->printEngine->property(QPrintEngine::PPK_SupportedResolutions).toList();
1226 QList<int> intlist;
1227 intlist.reserve(varlist.size());
1228 for (const auto &var : varlist)
1229 intlist << var.toInt();
1230 return intlist;
1231}
1232
1242{
1243 Q_D(QPrinter);
1244 if (d->printEngine->printerState() != QPrinter::Active)
1245 return false;
1246 return d->printEngine->newPage();
1247}
1248
1259{
1260 Q_D(QPrinter);
1261 return d->printEngine->abort();
1262}
1263
1270{
1271 Q_D(const QPrinter);
1272 return d->printEngine->printerState();
1273}
1274
1275#if defined(Q_OS_WIN) || defined(Q_QDOC)
1287QList<QPrinter::PaperSource> QPrinter::supportedPaperSources() const
1288{
1289 Q_D(const QPrinter);
1290 QVariant v = d->printEngine->property(QPrintEngine::PPK_PaperSources);
1291
1292 const QList<QVariant> variant_list = v.toList();
1294 int_list.reserve(variant_list.size());
1295 for (const auto &variant : variant_list)
1296 int_list << QPrinter::PaperSource(variant.toInt());
1297
1298 return int_list;
1299}
1300
1301#endif // Q_OS_WIN
1302
1320{
1321 Q_D(const QPrinter);
1322 return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
1323}
1324
1342{
1343 Q_D(QPrinter);
1345}
1346
1365{
1366 return d->pageRanges.firstPage();
1367}
1368
1389{
1390 return d->pageRanges.lastPage();
1391}
1392
1410void QPrinter::setFromTo(int from, int to)
1411{
1412 d->pageRanges.clear();
1413 if (from && to)
1414 d->pageRanges.addRange(from, to);
1415}
1416
1423{
1425
1426 Q_D(QPrinter);
1427 d->printRange = range;
1428}
1429
1440{
1441 Q_D(const QPrinter);
1442 return d->printRange;
1443}
1444
1445
1600
1601#endif // QT_NO_PRINTER
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
\inmodule QtCore \reentrant
Definition qfileinfo.h:22
QString suffix() const
Returns the suffix (extension) of the file.
\inmodule QtCore
Definition qhash.h:818
Definition qlist.h:74
qsizetype size() const noexcept
Definition qlist.h:386
QList< T > toList() const noexcept
Definition qlist.h:716
void reserve(qsizetype size)
Definition qlist.h:746
\inmodule QtCore
Definition qmargins.h:274
\inmodule QtGui
Definition qpagelayout.h:20
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.
Definition qpagelayout.h:24
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.
Definition qpagelayout.h:33
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.
void clear()
Removes all page ranges.
int lastPage() const
Returns the index of the last page covered by the page ranges, or 0 if the page ranges are empty.
int firstPage() const
Returns the index of the first page covered by the page ranges, or 0 if the page ranges are empty.
void addRange(int from, int to)
Adds the range specified with from and to to the ranges.
\inmodule QtGui
Definition qpagesize.h:22
bool isEquivalentTo(const QPageSize &other) const
Returns true if this page is equivalent to the other page, i.e.
\inmodule QtGui
QPageLayout pageLayout() const
QPagedPaintDevicePrivate * d
PdfVersion
The PdfVersion enum describes the version of the PDF file that is produced by QPrinter or QPdfWriter.
\inmodule QtGui
virtual Type type() const =0
Reimplement this function to return the paint engine \l{Type}.
@ Version_1_4
Definition qpdf_p.h:139
@ Version_A1b
Definition qpdf_p.h:140
@ Version_1_6
Definition qpdf_p.h:141
static QPlatformPrinterSupport * get()
The QPlatformPrinterSupport class provides an abstraction for print support.
virtual QPrintEngine * createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId=QString())
virtual QPaintEngine * createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode)
\reentrant
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
Definition qprinter.cpp:168
bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
Definition qprinter.cpp:211
QPageLayout pageLayout() const override
Definition qprinter.cpp:222
QPrinterPagedPaintDevicePrivate(QPrinter *p)
Definition qprinter.cpp:161
bool setPageOrientation(QPageLayout::Orientation orientation) override
Definition qprinter.cpp:201
bool setPageSize(const QPageSize &pageSize) override
Definition qprinter.cpp:184
uint use_default_engine
Definition qprinter_p.h:93
QPrinter * q_ptr
Definition qprinter_p.h:89
QPrinterInfo findValidPrinter(const QPrinterInfo &printer=QPrinterInfo())
Definition qprinter.cpp:45
QPrinter::PdfVersion pdfVersion
Definition qprinter_p.h:79
void initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer)
Definition qprinter.cpp:60
QPrinter::OutputFormat outputFormat
Definition qprinter_p.h:78
uint had_default_engines
Definition qprinter_p.h:94
QPrinter::PrinterMode printerMode
Definition qprinter_p.h:77
QSet< QPrintEngine::PrintEnginePropertyKey > m_properties
Definition qprinter_p.h:100
QPrintEngine * printEngine
Definition qprinter_p.h:80
void init(const QPrinterInfo &printer, QPrinter::PrinterMode mode)
Definition qprinter.cpp:460
QPaintEngine * realPaintEngine
Definition qprinter_p.h:84
QPaintEngine * paintEngine
Definition qprinter_p.h:81
void changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer)
Definition qprinter.cpp:97
QPrintEngine * realPrintEngine
Definition qprinter_p.h:83
void setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value)
Definition qprinter.cpp:151
static QPrinterPrivate * get(QPrinter *printer)
Definition qprinter_p.h:61
\reentrant
Definition qprinter.h:28
QRectF paperRect(Unit) const
bool supportsMultipleCopies() const
Definition qprinter.cpp:929
void setFontEmbeddingEnabled(bool enable)
PdfVersion pdfVersion() const
Definition qprinter.cpp:597
QString creator() const
Returns the name of the application that created the document.
Definition qprinter.cpp:797
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.
Definition qprinter.h:45
void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine)
This function is used by subclasses of QPrinter to specify custom print and paint engines (printEngin...
Definition qprinter.cpp:487
@ DevicePixel
Definition qprinter.h:81
void setPrintProgram(const QString &)
Sets the name of the program that should do the print job to printProg.
Definition qprinter.cpp:754
void setPaperSource(PaperSource)
Sets the paper source setting to source.
void setCollateCopies(bool collate)
Definition qprinter.cpp:963
QString printProgram() const
Returns the name of the program that sends the print output to the printer.
Definition qprinter.cpp:738
int toPage() const
void setPdfVersion(PdfVersion version)
Definition qprinter.cpp:578
ColorMode colorMode() const
Returns the current color mode.
Definition qprinter.cpp:877
OutputFormat
The OutputFormat enum is used to describe the format QPrinter should use for printing.
Definition qprinter.h:69
@ NativeFormat
Definition qprinter.h:69
@ PdfFormat
Definition qprinter.h:69
int devType() const override
Definition qprinter.cpp:605
QPaintEngine * paintEngine() const override
Returns the paint engine used by the printer.
void setOutputFormat(OutputFormat format)
Definition qprinter.cpp:544
ColorMode
This enum type is used to indicate whether QPrinter should print in color or not.
Definition qprinter.h:42
bool isValid() const
Definition qprinter.cpp:669
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.
Definition qprinter.cpp:767
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...
Definition qprinter.cpp:993
void setColorMode(ColorMode)
Sets the printer's color mode to newColorMode, which can be either Color or GrayScale.
Definition qprinter.cpp:864
PaperSource paperSource() const
Returns the printer's paper source.
QString outputFileName() const
Returns the name of the output file.
Definition qprinter.cpp:687
void setFromTo(int fromPage, int toPage)
PrinterMode
This enum describes the mode the printer should work in.
Definition qprinter.h:31
PrintRange printRange() const
int fromPage() const
bool abort()
Aborts the current print run.
void setOutputFileName(const QString &)
Sets the name of the output file to fileName.
Definition qprinter.cpp:712
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
Definition qprinter.h:64
PrinterState printerState() const
Returns the current state of the printer.
QPrinter(PrinterMode mode=ScreenResolution)
Creates a new printer object with the given mode.
Definition qprinter.cpp:441
QString printerName() const
Returns the printer name.
Definition qprinter.cpp:616
void setDocName(const QString &)
Sets the document name to name.
Definition qprinter.cpp:784
void setCreator(const QString &)
Sets the name of the application that created the document to creator.
Definition qprinter.cpp:814
PageOrder
This enum type is used by QPrinter to tell the application program how to print.
Definition qprinter.h:39
@ FirstPageFirst
Definition qprinter.h:39
void setPageOrder(PageOrder)
Sets the page order to pageOrder.
Definition qprinter.cpp:834
PrintRange
Used to specify the print range selection option.
Definition qprinter.h:72
@ Selection
Definition qprinter.h:72
QString printerSelectionOption() const
Returns the printer options selection string.
int copyCount() const
Definition qprinter.cpp:909
OutputFormat outputFormat() const
Definition qprinter.cpp:565
bool collateCopies() const
Definition qprinter.cpp:946
void setPrinterName(const QString &)
Sets the printer name to name.
Definition qprinter.cpp:633
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.
Definition qprinter.cpp:504
PageOrder pageOrder() const
Returns the current page order.
Definition qprinter.cpp:850
void setCopyCount(int)
Definition qprinter.cpp:894
\inmodule QtCore\reentrant
Definition qrect.h:483
iterator insert(const T &value)
Definition qset.h:155
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
Definition qstring.cpp:6498
\inmodule QtCore
Definition qvariant.h:64
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
Definition qvariant.h:707
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 >
Definition qvariant.h:531
#define this
Definition dialogs.cpp:9
Combined button and popup list for selecting options.
@ CaseInsensitive
#define Q_UNLIKELY(x)
std::pair< T1, T2 > QPair
#define qApp
static const QCssKnownValue properties[NumProperties - 1]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qWarning
Definition qlogging.h:162
#define qFatal
Definition qlogging.h:164
GLsizei const GLfloat * v
[13]
GLenum mode
GLuint64 key
GLenum GLenum GLsizei count
GLsizei range
GLboolean enable
GLfloat units
GLuint name
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
GLuint GLenum option
constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
Definition qpair.h:19
QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
#define ABORT_IF_ACTIVE(location)
Definition qprinter.cpp:30
qreal qt_pixelMultiplier(int resolution)
#define fp
double qreal
Definition qtypes.h:92
static int toInt(const QChar &qc, int R)
QFileInfo fi("c:/temp/foo")
[newstuff]
QVariant variant
[1]
QItemEditorCreatorBase * creator