From af5483e35a604cfe08e712235113bac0a0c07a56 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 7 Feb 2022 19:05:44 +0100 Subject: Update PDF manual tests - remove import versions - use Qt Quick Dialogs - use PdfPageImage in the more complex ones The BusyIndicator seems to work better while pages are rendering. Change-Id: Ie9588cff897f969d679199f2fdb113079bf8685d Reviewed-by: Richard Moe Gustavsen --- tests/manual/quick/pdf/listview.qml | 7 +++---- tests/manual/quick/pdf/pessimizedListView.qml | 20 ++++++++++---------- tests/manual/quick/pdf/simplest.qml | 4 ++-- tests/manual/quick/pdf/withdoc.qml | 23 +++++++++++------------ 4 files changed, 26 insertions(+), 28 deletions(-) (limited to 'tests') diff --git a/tests/manual/quick/pdf/listview.qml b/tests/manual/quick/pdf/listview.qml index 361ae7d89..65da5d483 100644 --- a/tests/manual/quick/pdf/listview.qml +++ b/tests/manual/quick/pdf/listview.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -47,9 +47,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.14 -import QtQuick.Window 2.14 -import QtQuick.Pdf 5.15 +import QtQuick +import QtQuick.Pdf Window { width: 600 diff --git a/tests/manual/quick/pdf/pessimizedListView.qml b/tests/manual/quick/pdf/pessimizedListView.qml index 4ae0edabe..d8e0fadd0 100644 --- a/tests/manual/quick/pdf/pessimizedListView.qml +++ b/tests/manual/quick/pdf/pessimizedListView.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -47,11 +47,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.Layouts 1.14 -import QtQuick.Pdf 5.15 -import Qt.labs.platform 1.1 as P +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Layouts +import QtQuick.Pdf ApplicationWindow { width: 900 @@ -127,11 +127,11 @@ ApplicationWindow { source: "test.pdf" } - P.FileDialog { + FileDialog { id: fileDialog title: "Open a PDF file" nameFilters: [ "PDF files (*.pdf)" ] - onAccepted: doc.source = file + onAccepted: doc.source = selectedFile } ListView { @@ -150,15 +150,15 @@ ApplicationWindow { anchors.centerIn: parent running: image.status === Image.Loading } - Image { + PdfPageImage { id: image + document: doc scale: imageScale anchors.centerIn: parent sourceSize.width: doc.pagePointSize(index).width * oversamplingSB.value height: 100 fillMode: Image.PreserveAspectFit objectName: "PDF page " + index - source: doc.source currentFrame: index asynchronous: asyncCB.checked cache: cacheCB.checked diff --git a/tests/manual/quick/pdf/simplest.qml b/tests/manual/quick/pdf/simplest.qml index 0571493af..4178a87af 100644 --- a/tests/manual/quick/pdf/simplest.qml +++ b/tests/manual/quick/pdf/simplest.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -47,7 +47,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.14 +import QtQuick Image { id: image diff --git a/tests/manual/quick/pdf/withdoc.qml b/tests/manual/quick/pdf/withdoc.qml index 66b17994f..db401d08e 100644 --- a/tests/manual/quick/pdf/withdoc.qml +++ b/tests/manual/quick/pdf/withdoc.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -47,12 +47,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import Qt.labs.platform 1.1 as Platform -import QtQuick.Pdf 5.15 -import QtQuick.Shapes 1.14 -import QtQuick.Window 2.14 +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Pdf +import QtQuick.Shapes Window { width: 800 @@ -67,11 +66,11 @@ Window { onPasswordRequired: function() { passwordDialog.open() } } - Platform.FileDialog { + FileDialog { id: fileDialog title: "Open a PDF file" nameFilters: [ "PDF files (*.pdf)" ] - onAccepted: doc.source = file + onAccepted: doc.source = selectedFile } Dialog { @@ -130,9 +129,9 @@ Window { id: paper width: image.width height: image.height - Image { + PdfPageImage { id: image - source: doc.status === PdfDocument.Ready ? doc.source : "" + document: doc property real zoomFactor: Math.sqrt(2) @@ -206,7 +205,7 @@ Window { y: rect.y width: rect.width height: rect.height -// HoverHandler { cursorShape: Qt.PointingHandCursor } // 5.15 onward (QTBUG-68073) + HoverHandler { cursorShape: Qt.PointingHandCursor } TapHandler { onTapped: { if (page >= 0) -- cgit v1.2.3