summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-03 18:42:30 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-04 08:37:59 +0200
commit00a5629d8de18bc1a5dfb6e2526c03b4b021c903 (patch)
treed444ede3eb66e5455e09c4de3fda32bcd7437a4a /src/gui
parent6b171dc6c0c0f0a822b212df77b58b28bd92716c (diff)
Remove deprecated QPrinter and QPagedPaintDevice APIs
Adjusting the QPrinter test case - some use cases no longer exist, or are already tested in QPageSize and QPageLayout tests. Adjust examples and manual tests. Change-Id: I01cbc65f3d8031aea2dac86dd942126ba708b111 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qpagedpaintdevice.cpp165
-rw-r--r--src/gui/painting/qpagedpaintdevice.h185
-rw-r--r--src/gui/painting/qpagelayout.h1
-rw-r--r--src/gui/painting/qpdfwriter.cpp49
-rw-r--r--src/gui/painting/qpdfwriter.h20
5 files changed, 4 insertions, 416 deletions
diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp
index 2149bd8cff..dba143b7e3 100644
--- a/src/gui/painting/qpagedpaintdevice.cpp
+++ b/src/gui/painting/qpagedpaintdevice.cpp
@@ -42,42 +42,6 @@
QT_BEGIN_NAMESPACE
-// ### Qt 6: remove when the deprecated constructor is removed
-class QDummyPagedPaintDevicePrivate : public QPagedPaintDevicePrivate
-{
- bool setPageLayout(const QPageLayout &newPageLayout) override
- {
- m_pageLayout = newPageLayout;
- return m_pageLayout.isEquivalentTo(newPageLayout);
- }
-
- bool setPageSize(const QPageSize &pageSize) override
- {
- m_pageLayout.setPageSize(pageSize);
- return m_pageLayout.pageSize().isEquivalentTo(pageSize);
- }
-
- bool setPageOrientation(QPageLayout::Orientation orientation) override
- {
- m_pageLayout.setOrientation(orientation);
- return m_pageLayout.orientation() == orientation;
- }
-
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
- {
- m_pageLayout.setUnits(units);
- m_pageLayout.setMargins(margins);
- return m_pageLayout.margins() == margins && m_pageLayout.units() == units;
- }
-
- QPageLayout pageLayout() const override
- {
- return m_pageLayout;
- }
-
- QPageLayout m_pageLayout;
-};
-
QPagedPaintDevicePrivate::~QPagedPaintDevicePrivate()
{
delete rangeCollection;
@@ -96,15 +60,6 @@ QPagedPaintDevicePrivate::~QPagedPaintDevicePrivate()
QPdfWriter and QPrinter inherit from it.
*/
-/*!
- Constructs a new paged paint device.
-
- \deprecated
- */
-QPagedPaintDevice::QPagedPaintDevice()
- : d(new QDummyPagedPaintDevicePrivate)
-{
-}
/*!
\internal
@@ -298,75 +253,6 @@ QPagedPaintDevicePrivate *QPagedPaintDevice::dd()
*/
/*!
- Sets the size of the a page to \a size.
-
- \sa setPageSizeMM()
- */
-void QPagedPaintDevice::setPageSize(PageSize size)
-{
- d->setPageSize(QPageSize(QPageSize::PageSizeId(size)));
-}
-
-/*!
- Returns the currently used page size.
- */
-QPagedPaintDevice::PageSize QPagedPaintDevice::pageSize() const
-{
- return PageSize(d->pageLayout().pageSize().id());
-}
-
-/*!
- \obsolete Use setPageSize(QPageSize) instead.
- Sets the page size to \a size. \a size is specified in millimeters.
-
- If the size matches a standard QPagedPaintDevice::PageSize then that page
- size will be used, otherwise QPagedPaintDevice::Custom will be set.
-*/
-void QPagedPaintDevice::setPageSizeMM(const QSizeF &size)
-{
- d->setPageSize(QPageSize(size, QPageSize::Millimeter));
-}
-
-/*!
- \obsolete Use pageLayout().pageSize() instead.
-
- Returns the page size in millimeters.
- */
-QSizeF QPagedPaintDevice::pageSizeMM() const
-{
- return d->pageLayout().pageSize().size(QPageSize::Millimeter);
-}
-
-/*!
- \obsolete Use setPageMargins(QMarginsF, QPageLayout::Unit) instead.
- Sets the margins to be used to \a margins.
-
- Margins are specified in millimeters.
-
- The margins are purely a hint to the drawing method. They don't affect the
- coordinate system or clipping.
-
- \sa margins()
- */
-void QPagedPaintDevice::setMargins(const QMarginsF &margins)
-{
- d->setPageMargins(margins, QPageLayout::Millimeter);
-}
-
-/*!
- \obsolete Use pageLayout().margins() instead.
- Returns the current margins of the paint device. The default is 0.
-
- Margins are specified in millimeters.
-
- \sa setMargins()
- */
-QMarginsF QPagedPaintDevice::margins() const
-{
- return d->pageLayout().margins(QPageLayout::Millimeter);
-}
-
-/*!
\since 5.3
Sets the page layout to \a newPageLayout.
@@ -436,28 +322,6 @@ bool QPagedPaintDevice::setPageOrientation(QPageLayout::Orientation orientation)
/*!
\since 5.3
- Set the page \a margins in the current page layout units.
-
- You should call this before calling QPainter::begin(), or immediately
- before calling newPage() to apply the new margins to a new page.
- You should not call any painting methods between a call to setPageMargins()
- and newPage() as the wrong paint metrics may be used.
-
- To get the current page margins use pageLayout().pageMargins().
-
- Returns true if the page margins were successfully set to \a margins.
-
- \sa pageLayout()
-*/
-
-bool QPagedPaintDevice::setPageMargins(const QMarginsF &margins)
-{
- return setPageMargins(margins, pageLayout().units());
-}
-
-/*!
- \since 5.3
-
Set the page \a margins defined in the given \a units.
You should call this before calling QPainter::begin(), or immediately
@@ -494,33 +358,4 @@ QPageLayout QPagedPaintDevice::pageLayout() const
return d->pageLayout();
}
-/*!
- \internal
-
- \deprecated
-
- Returns the internal device page layout.
-*/
-
-QPageLayout QPagedPaintDevice::devicePageLayout() const
-{
- qWarning("QPagedPaintDevice::devicePageLayout() is deprecated, just use QPagedPaintDevice::pageLayout()");
- return d->pageLayout();
-}
-
-/*!
- \internal
-
- \deprecated
-
- Returns the internal device page layout.
-*/
-
-QPageLayout &QPagedPaintDevice::devicePageLayout()
-{
- qWarning("QPagedPaintDevice::devicePageLayout() is deprecated, you shouldn't be using this at all.");
- static QPageLayout dummy;
- return dummy;
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index f4e671f2d2..ab304250c9 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -55,199 +55,22 @@ class QPagedPaintDevicePrivate;
class Q_GUI_EXPORT QPagedPaintDevice : public QPaintDevice
{
public:
- QT_DEPRECATED QPagedPaintDevice();
~QPagedPaintDevice();
virtual bool newPage() = 0;
- // ### Qt6 Remove in favor of QPage::PageSize
- // NOTE: Must keep in sync with QPageSize and QPrinter
- enum PageSize {
- // Existing Qt sizes
- A4,
- B5,
- Letter,
- Legal,
- Executive,
- A0,
- A1,
- A2,
- A3,
- A5,
- A6,
- A7,
- A8,
- A9,
- B0,
- B1,
- B10,
- B2,
- B3,
- B4,
- B6,
- B7,
- B8,
- B9,
- C5E,
- Comm10E,
- DLE,
- Folio,
- Ledger,
- Tabloid,
- Custom,
-
- // New values derived from PPD standard
- A10,
- A3Extra,
- A4Extra,
- A4Plus,
- A4Small,
- A5Extra,
- B5Extra,
-
- JisB0,
- JisB1,
- JisB2,
- JisB3,
- JisB4,
- JisB5,
- JisB6,
- JisB7,
- JisB8,
- JisB9,
- JisB10,
-
- // AnsiA = Letter,
- // AnsiB = Ledger,
- AnsiC,
- AnsiD,
- AnsiE,
- LegalExtra,
- LetterExtra,
- LetterPlus,
- LetterSmall,
- TabloidExtra,
-
- ArchA,
- ArchB,
- ArchC,
- ArchD,
- ArchE,
-
- Imperial7x9,
- Imperial8x10,
- Imperial9x11,
- Imperial9x12,
- Imperial10x11,
- Imperial10x13,
- Imperial10x14,
- Imperial12x11,
- Imperial15x11,
-
- ExecutiveStandard,
- Note,
- Quarto,
- Statement,
- SuperA,
- SuperB,
- Postcard,
- DoublePostcard,
- Prc16K,
- Prc32K,
- Prc32KBig,
-
- FanFoldUS,
- FanFoldGerman,
- FanFoldGermanLegal,
-
- EnvelopeB4,
- EnvelopeB5,
- EnvelopeB6,
- EnvelopeC0,
- EnvelopeC1,
- EnvelopeC2,
- EnvelopeC3,
- EnvelopeC4,
- // EnvelopeC5 = C5E,
- EnvelopeC6,
- EnvelopeC65,
- EnvelopeC7,
- // EnvelopeDL = DLE,
-
- Envelope9,
- // Envelope10 = Comm10E,
- Envelope11,
- Envelope12,
- Envelope14,
- EnvelopeMonarch,
- EnvelopePersonal,
-
- EnvelopeChou3,
- EnvelopeChou4,
- EnvelopeInvite,
- EnvelopeItalian,
- EnvelopeKaku2,
- EnvelopeKaku3,
- EnvelopePrc1,
- EnvelopePrc2,
- EnvelopePrc3,
- EnvelopePrc4,
- EnvelopePrc5,
- EnvelopePrc6,
- EnvelopePrc7,
- EnvelopePrc8,
- EnvelopePrc9,
- EnvelopePrc10,
- EnvelopeYou4,
-
- // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
- LastPageSize = EnvelopeYou4,
- NPageSize = LastPageSize,
- NPaperSize = LastPageSize,
-
- // Convenience overloads for naming consistency
- AnsiA = Letter,
- AnsiB = Ledger,
- EnvelopeC5 = C5E,
- EnvelopeDL = DLE,
- Envelope10 = Comm10E
- };
-
// keep in sync with QPdfEngine::PdfVersion!
enum PdfVersion { PdfVersion_1_4, PdfVersion_A1b, PdfVersion_1_6 };
- // ### Qt6 Make these virtual
- bool setPageLayout(const QPageLayout &pageLayout);
- bool setPageSize(const QPageSize &pageSize);
- bool setPageOrientation(QPageLayout::Orientation orientation);
- bool setPageMargins(const QMarginsF &margins);
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units);
+ virtual bool setPageLayout(const QPageLayout &pageLayout);
+ virtual bool setPageSize(const QPageSize &pageSize);
+ virtual bool setPageOrientation(QPageLayout::Orientation orientation);
+ virtual bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units = QPageLayout::Millimeter);
QPageLayout pageLayout() const;
-#if QT_DEPRECATED_SINCE(5,15)
- QT_DEPRECATED_VERSION_X_5_15("Use setPageSize(QPageSize) instead.")
- virtual void setPageSize(PageSize size);
- QT_DEPRECATED_VERSION_X_5_15("Use pageLayout().pageSize().id() instead.")
- PageSize pageSize() const;
-
- QT_DEPRECATED_VERSION_X_5_15("Use setPageSize(QPageSize) instead.")
- virtual void setPageSizeMM(const QSizeF &size);
- QT_DEPRECATED_VERSION_X_5_15("Use pageLayout().pageSize() instead.")
- QSizeF pageSizeMM() const;
-#endif
-
-#if QT_DEPRECATED_SINCE(5,15)
- QT_DEPRECATED_VERSION_X_5_15("Use setPageMargins(QMarginsF, QPageLayout::Unit) instead.")
- virtual void setMargins(const QMarginsF &margins);
- QT_DEPRECATED_VERSION_X_5_15("Use pageLayout().margins() instead.")
- QMarginsF margins() const;
-#endif
-
protected:
QPagedPaintDevice(QPagedPaintDevicePrivate *dd);
QPagedPaintDevicePrivate *dd();
- QT_DEPRECATED QPageLayout devicePageLayout() const;
- QT_DEPRECATED QPageLayout &devicePageLayout();
friend class QPagedPaintDevicePrivate;
QPagedPaintDevicePrivate *d;
};
diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h
index 7ee0ce7a76..6965606252 100644
--- a/src/gui/painting/qpagelayout.h
+++ b/src/gui/painting/qpagelayout.h
@@ -66,7 +66,6 @@ public:
Cicero
};
- // NOTE: Must keep in sync with QPrinter::Orientation
enum Orientation {
Portrait,
Landscape
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index 1de8ff0bcc..5b2bbc37a5 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -417,37 +417,6 @@ void QPdfWriter::addFileAttachment(const QString &fileName, const QByteArray &da
*/
#endif
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-/*!
- \reimp
-
- \obsolete Use setPageSize(QPageSize(id)) instead
-
- \sa setPageSize()
-*/
-
-void QPdfWriter::setPageSize(PageSize size)
-{
- setPageSize(QPageSize(QPageSize::PageSizeId(size)));
-}
-
-/*!
- \reimp
-
- \obsolete Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead
-
- \sa setPageSize()
-*/
-
-void QPdfWriter::setPageSizeMM(const QSizeF &size)
-{
- setPageSize(QPageSize(size, QPageSize::Millimeter));
-}
-QT_WARNING_POP
-#endif
-
/*!
\internal
@@ -469,24 +438,6 @@ bool QPdfWriter::newPage()
return d->engine->newPage();
}
-
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-/*!
- \reimp
-
- \obsolete Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead
-
- \sa setPageMargins()
- */
-void QPdfWriter::setMargins(const QMarginsF &m)
-{
- setPageMargins(m, QPageLayout::Millimeter);
-}
-QT_WARNING_POP
-#endif
-
QT_END_NAMESPACE
#endif // QT_NO_PDF
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index fa5750dcf0..aa068e20e0 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -80,26 +80,6 @@ public:
void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType = QString());
-#ifdef Q_QDOC
- bool setPageLayout(const QPageLayout &pageLayout);
- bool setPageSize(const QPageSize &pageSize);
- bool setPageOrientation(QPageLayout::Orientation orientation);
- bool setPageMargins(const QMarginsF &margins);
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units);
- QPageLayout pageLayout() const;
-#else
- using QPagedPaintDevice::setPageSize;
-#endif
-
-#if QT_DEPRECATED_SINCE(5, 14)
- QT_DEPRECATED_X("Use setPageSize(QPageSize(id)) instead")
- void setPageSize(PageSize size) override;
- QT_DEPRECATED_X("Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead")
- void setPageSizeMM(const QSizeF &size) override;
- QT_DEPRECATED_X("Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead")
- void setMargins(const QMarginsF &m) override;
-#endif
-
protected:
QPaintEngine *paintEngine() const override;
int metric(PaintDeviceMetric id) const override;