diff options
Diffstat (limited to 'tests/manual/dialogs/printdialogpanel.cpp')
-rw-r--r-- | tests/manual/dialogs/printdialogpanel.cpp | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp index 29dc33285b..716faa48c6 100644 --- a/tests/manual/dialogs/printdialogpanel.cpp +++ b/tests/manual/dialogs/printdialogpanel.cpp @@ -1,30 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #ifndef QT_NO_PRINTER @@ -157,17 +134,19 @@ QTextStream &operator<<(QTextStream &s, const QRectF &rect) QTextStream &operator<<(QTextStream &s, const QPrinter &printer) { - s << '"' << printer.printerName() << "\"\nPaper #" <<printer.paperSize() - << " \"" << printer.paperName() << '"' - << (printer.orientation() == QPrinter::Portrait ? ", Portrait" : ", Landscape"); + const auto pageLayout = printer.pageLayout(); + const auto pageSize = pageLayout.pageSize(); + s << '"' << printer.printerName() << "\"\nPaper #" << pageSize.id() + << " \"" << pageSize.name() << '"' + << (pageLayout.orientation() == QPageLayout::Portrait ? ", Portrait" : ", Landscape"); if (printer.fullPage()) s << ", full page"; s << "\nPaper size: " - << printer.paperSize(QPrinter::Point) << "pt " - << printer.paperSize(QPrinter::Millimeter) << "mm " - << "\n " << printer.paperSize(QPrinter::DevicePixel) << "device pt " - << printer.paperSize(QPrinter::Inch) << "inch " - << "\nPagedPaintDevSize: " << printer.pageSizeMM() << "mm" + << pageSize.sizePoints() << "pt " + << pageSize.size(QPageSize::Millimeter) << "mm " + << "\n " << pageSize.sizePixels(printer.resolution()) << " device pt " + << pageSize.size(QPageSize::Inch) << "inch " + << "\n " << pageSize.size(QPageSize::Millimeter) << "mm" << "\nLogical resolution : " << printer.logicalDpiX() << ',' << printer.logicalDpiY() << "DPI" << "\nPhysical resolution: " << printer.physicalDpiX() << ',' << printer.physicalDpiY() << "DPI" << "\nPaperRect: " << printer.paperRect(QPrinter::Point) << "pt " @@ -236,7 +215,7 @@ static bool print(QPrinter *printer, QString *errorMessage) return false; } - const QRectF pageF = printer->pageRect(); + const QRectF pageF = printer->pageRect(QPrinter::DevicePixel); QFont font = painter.font(); font.setFamily("Courier"); @@ -289,7 +268,7 @@ static bool print(QPrinter *printer, QWidget *dialogParent) class PrintPreviewDialog : public QPrintPreviewDialog { Q_OBJECT public: - explicit PrintPreviewDialog(QPrinter *printer, QWidget *parent = 0) : QPrintPreviewDialog(printer, parent) + explicit PrintPreviewDialog(QPrinter *printer, QWidget *parent = nullptr) : QPrintPreviewDialog(printer, parent) { connect(this, SIGNAL(paintRequested(QPrinter*)), this, SLOT(slotPaintRequested(QPrinter*))); } |