diff options
Diffstat (limited to 'tests/manual')
36 files changed, 1238 insertions, 768 deletions
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt new file mode 100644 index 000000000..c6d3e6e50 --- /dev/null +++ b/tests/manual/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(quick) +add_subdirectory(widgets) diff --git a/tests/manual/quick/CMakeLists.txt b/tests/manual/quick/CMakeLists.txt new file mode 100644 index 000000000..0562237b4 --- /dev/null +++ b/tests/manual/quick/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(touchbrowser) diff --git a/tests/manual/quick/pdf/bookmarks-list.qml b/tests/manual/quick/pdf/bookmarks-list.qml new file mode 100644 index 000000000..2be0d6848 --- /dev/null +++ b/tests/manual/quick/pdf/bookmarks-list.qml @@ -0,0 +1,136 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Pdf +import QtQuick.Shapes + +ApplicationWindow { + id: root + width: 800 + height: 940 + title: doc.source + visible: true + + property PdfDocument doc: PdfDocument { source: "test.pdf" } + + Component.onCompleted: { + if (Application.arguments.length > 2) + doc.source = Application.arguments[Application.arguments.length - 1] + } + FileDialog { + id: fileDialog + title: "Open a PDF file" + nameFilters: [ "PDF files (*.pdf)" ] + onAccepted: doc.source = selectedFile + } + + SplitView { + anchors.fill: parent + + Pane { + SplitView.minimumWidth: 6 + SplitView.preferredWidth: 200 + clip: true + ListView { + ScrollIndicator.vertical: ScrollIndicator { } + anchors.fill: parent + delegate: ItemDelegate { + width: parent.width + text: model.title + background: Item { } + onClicked: image.currentFrame = page + } + model: PdfBookmarkModel { + document: root.doc + } + } + } + + Flickable { + contentWidth: paper.width + contentHeight: paper.height + z: -1 + Rectangle { + id: paper + width: image.width + height: image.height + PdfPageImage { + id: image + document: doc + + property real zoomFactor: Math.sqrt(2) + + Shortcut { + sequence: StandardKey.MoveToNextPage + enabled: image.currentFrame < image.frameCount - 1 + onActivated: image.currentFrame++ + } + Shortcut { + sequence: StandardKey.MoveToPreviousPage + enabled: image.currentFrame > 0 + onActivated: image.currentFrame-- + } + Shortcut { + sequence: StandardKey.ZoomIn + enabled: image.sourceSize.width < 5000 + onActivated: { + image.sourceSize.width = image.implicitWidth * image.zoomFactor + image.sourceSize.height = image.implicitHeight * image.zoomFactor + } + } + Shortcut { + sequence: StandardKey.ZoomOut + enabled: image.width > 50 + onActivated: { + image.sourceSize.width = image.implicitWidth / image.zoomFactor + image.sourceSize.height = image.implicitHeight / image.zoomFactor + } + } + Shortcut { + sequence: "Ctrl+0" + onActivated: image.sourceSize = undefined + } + Shortcut { + sequence: StandardKey.Open + onActivated: fileDialog.open() + } + Shortcut { + sequence: StandardKey.Quit + onActivated: Qt.quit() + } + } + + Repeater { + model: PdfLinkModel { + id: linkModel + document: doc + page: image.currentFrame + } + delegate: Rectangle { + color: "transparent" + border.color: "lightgrey" + x: rect.x + y: rect.y + width: rect.width + height: rect.height + HoverHandler { cursorShape: Qt.PointingHandCursor } + TapHandler { + onTapped: { + if (page >= 0) + image.currentFrame = page + else + Qt.openUrlExternally(url) + } + } + } + } + } + } + } + Text { + anchors { bottom: parent.bottom; right: parent.right; margins: 6 } + text: "page " + doc.pageLabel(image.currentFrame) + " of " + doc.pageCount + } +} diff --git a/tests/manual/quick/pdf/bookmarks.qml b/tests/manual/quick/pdf/bookmarks.qml new file mode 100644 index 000000000..e12629b31 --- /dev/null +++ b/tests/manual/quick/pdf/bookmarks.qml @@ -0,0 +1,147 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Pdf +import QtQuick.Shapes + +ApplicationWindow { + id: root + width: 800 + height: 940 + color: "darkgrey" + title: doc.source + visible: true + + property PdfDocument doc: PdfDocument { source: "test.pdf" } + + Component.onCompleted: { + if (Application.arguments.length > 2) + doc.source = Application.arguments[Application.arguments.length - 1] + } + FileDialog { + id: fileDialog + title: "Open a PDF file" + nameFilters: [ "PDF files (*.pdf)" ] + onAccepted: doc.source = selectedFile + } + + SplitView { + anchors.fill: parent + + Pane { + SplitView.minimumWidth: 6 + SplitView.preferredWidth: 200 + TreeView { + id: bookmarksTree + anchors.fill: parent + columnWidthProvider: function() { return width } + onWidthChanged: forceLayout() // workaround to avoid column width getting stuck + clip: true + delegate: TreeViewDelegate { + width: parent.width + onClicked: image.currentFrame = page + } + model: PdfBookmarkModel { + document: root.doc + } + ScrollIndicator.vertical: ScrollIndicator { + // get the ScrollIndicator out into the margin area of the Pane... + // no need to overlap the tree when so much space is wasted anyway + parent: bookmarksTree.parent + anchors { + top: bookmarksTree.top + left: bookmarksTree.right + bottom: bookmarksTree.bottom + } + } + } + } + + ScrollView { + contentWidth: paper.width + contentHeight: paper.height + + Rectangle { + id: paper + width: image.width + height: image.height + PdfPageImage { + id: image + document: doc + + property real zoomFactor: Math.sqrt(2) + + Shortcut { + sequence: StandardKey.MoveToNextPage + enabled: image.currentFrame < image.frameCount - 1 + onActivated: image.currentFrame++ + } + Shortcut { + sequence: StandardKey.MoveToPreviousPage + enabled: image.currentFrame > 0 + onActivated: image.currentFrame-- + } + Shortcut { + sequence: StandardKey.ZoomIn + enabled: image.sourceSize.width < 5000 + onActivated: { + image.sourceSize.width = image.implicitWidth * image.zoomFactor + image.sourceSize.height = image.implicitHeight * image.zoomFactor + } + } + Shortcut { + sequence: StandardKey.ZoomOut + enabled: image.width > 50 + onActivated: { + image.sourceSize.width = image.implicitWidth / image.zoomFactor + image.sourceSize.height = image.implicitHeight / image.zoomFactor + } + } + Shortcut { + sequence: "Ctrl+0" + onActivated: image.sourceSize = undefined + } + Shortcut { + sequence: StandardKey.Open + onActivated: fileDialog.open() + } + Shortcut { + sequence: StandardKey.Quit + onActivated: Qt.quit() + } + } + + Repeater { + model: PdfLinkModel { + id: linkModel + document: doc + page: image.currentFrame + } + delegate: Rectangle { + color: "transparent" + border.color: "lightgrey" + x: rect.x + y: rect.y + width: rect.width + height: rect.height + HoverHandler { cursorShape: Qt.PointingHandCursor } + TapHandler { + onTapped: { + if (page >= 0) + image.currentFrame = page + else + Qt.openUrlExternally(url) + } + } + } + } + } + } + } + Label { + anchors { bottom: parent.bottom; right: parent.right; margins: 6 } + text: "page " + doc.pageLabel(image.currentFrame) + " of " + doc.pageCount + } +} diff --git a/tests/manual/quick/pdf/gridview.qml b/tests/manual/quick/pdf/gridview.qml new file mode 100644 index 000000000..773e72388 --- /dev/null +++ b/tests/manual/quick/pdf/gridview.qml @@ -0,0 +1,62 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Pdf + +Window { + width: 320 + height: 440 + color: "lightgrey" + title: doc.source + visible: true + + property real cellSize: 150 + + PdfDocument { + id: doc + source: "test.pdf" + } + + GridView { + id: view + anchors.fill: parent + anchors.margins: 10 + model: doc.pageModel + cellWidth: cellSize + cellHeight: cellSize + delegate: Item { + required property int index + required property string label + required property size pointSize + width: view.cellWidth + height: view.cellHeight + Rectangle { + id: paper + width: image.width + height: image.height + x: (parent.width - width) / 2 + y: (parent.height - height - pageNumber.height) / 2 + PdfPageImage { + id: image + document: doc + currentFrame: index + asynchronous: true + fillMode: Image.PreserveAspectFit + property bool landscape: pointSize.width > pointSize.height + width: landscape ? Math.min(view.cellWidth, pointSize.width) + : height * pointSize.width / pointSize.height + height: landscape ? width * pointSize.height / pointSize.width + : Math.min(view.cellHeight - pageNumber.height, pointSize.height) + sourceSize.width: width + sourceSize.height: height + } + } + Text { + id: pageNumber + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + text: "Page " + label + } + } + } +} diff --git a/tests/manual/quick/pdf/listview.qml b/tests/manual/quick/pdf/listview.qml index 361ae7d89..d01be9e86 100644 --- a/tests/manual/quick/pdf/listview.qml +++ b/tests/manual/quick/pdf/listview.qml @@ -1,55 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.14 -import QtQuick.Window 2.14 -import QtQuick.Pdf 5.15 +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Pdf Window { width: 600 @@ -82,7 +34,7 @@ Window { } } Text { - text: "Page " + (image.currentFrame + 1) + text: "Page " + doc.pageLabel(image.currentFrame) } } } diff --git a/tests/manual/quick/pdf/multipleDocuments.qml b/tests/manual/quick/pdf/multipleDocuments.qml new file mode 100644 index 000000000..9d08178f0 --- /dev/null +++ b/tests/manual/quick/pdf/multipleDocuments.qml @@ -0,0 +1,182 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Layouts +import QtQuick.Pdf +import Qt.labs.animation + +ApplicationWindow { + id: root + width: 1280 + height: 1024 + color: "transparent" + flags: Qt.FramelessWindowHint + visibility: Window.FullScreen + property string source // for main.cpp + property real scaleStep: Math.sqrt(2) + + Component { + id: pdfWindow + + PdfPageView { + property alias source: document.source + + Rectangle { + visible: parent.activeFocus + color: "transparent" + border.color: "cyan" + border.width: 3 + anchors.fill: parent + anchors.margins: -border.width + anchors.topMargin: -toolbar.height - border.width + } + + ToolBar { + id: toolbar + width: parent.width + y: -height + RowLayout { + anchors.fill: parent + anchors.rightMargin: 6 + ToolButton { + action: Action { + shortcut: StandardKey.ZoomIn + enabled: pageView.sourceSize.width < 10000 + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-in.svg" + onTriggered: pageView.renderScale *= root.scaleStep + } + } + ToolButton { + action: Action { + shortcut: StandardKey.ZoomOut + enabled: pageView.sourceSize.width > 50 + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-out.svg" + onTriggered: pageView.renderScale /= root.scaleStep + } + } + ToolButton { + action: Action { + shortcut: "Ctrl+0" + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-original.svg" + onTriggered: pageView.resetScale() + } + } + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/go-previous-view-page.svg" + enabled: pageView.backEnabled + onTriggered: pageView.back() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "go back" + } + SpinBox { + id: currentPageSB + from: 1 + to: document.pageCount + editable: true + value: pageView.currentPage + 1 + onValueModified: pageView.goToPage(value - 1) + Layout.maximumWidth: 60 + } + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/go-next-view-page.svg" + enabled: pageView.forwardEnabled + onTriggered: pageView.forward() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "go forward" + } + Text { + text: document.title + elide: Text.ElideRight + Layout.fillWidth: true + } + DragHandler { + target: pageView + } + TapHandler { + onTapped: pageView.z++ + } + ToolButton { + action: Action { + shortcut: StandardKey.Close + text: "☒" + onTriggered: pageView.destroy() + } + } + } + } + + id: pageView + document: PdfDocument { + id: document + source: Qt.resolvedUrl(root.source) + onStatusChanged: (status) => { if (status === PdfDocument.Error) errorDialog.open() } + } + + DragHandler { + acceptedButtons: Qt.MiddleButton + } + DragHandler { + acceptedDevices: PointerDevice.TouchScreen + } + HoverHandler { + onHoveredChanged: if (hovered) pageView.forceActiveFocus() + } + + Dialog { + id: errorDialog + title: "Error loading " + document.source + standardButtons: Dialog.Ok + modal: true + closePolicy: Popup.CloseOnEscape + anchors.centerIn: parent + width: 300 + + Label { + id: errorField + text: document.error + } + } + } + } + + Shortcut { + sequence: StandardKey.MoveToPreviousPage + onActivated: root.activeFocusItem.goToPage(root.activeFocusItem.currentPage - 1) + } + Shortcut { + sequence: StandardKey.MoveToNextPage + onActivated: root.activeFocusItem.goToPage(root.activeFocusItem.currentPage + 1) + } + Shortcut { + sequence: StandardKey.Open + onActivated: fileDialog.open() + } + Shortcut { + sequence: StandardKey.Quit + onActivated: Qt.quit() + } + + function open(src) { + var win = pdfWindow.createObject(root, { source: src, y: 50 }) + } + + Component.onCompleted: { + if (Application.arguments.length > 2) + root.open(Application.arguments[Application.arguments.length - 1]) + } + + FileDialog { + id: fileDialog + title: "Open a PDF file" + nameFilters: [ "PDF files (*.pdf)" ] + onAccepted: root.open(selectedFile) + } +} diff --git a/tests/manual/quick/pdf/pdfPageView.qml b/tests/manual/quick/pdf/pdfPageView.qml new file mode 100644 index 000000000..475e1d608 --- /dev/null +++ b/tests/manual/quick/pdf/pdfPageView.qml @@ -0,0 +1,316 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Layouts +import QtQuick.Pdf +import Qt.labs.animation + +ApplicationWindow { + id: root + width: 800 + height: 1024 + color: "lightgrey" + title: document.title + visible: true + property string source // for main.cpp + property real scaleStep: Math.sqrt(2) + + header: ToolBar { + RowLayout { + anchors.fill: parent + anchors.rightMargin: 6 + ToolButton { + action: Action { + shortcut: StandardKey.Open + icon.source: "../../../../examples/pdf/pdfviewer/resources/document-open.svg" + onTriggered: fileDialog.open() + } + } + ToolButton { + action: Action { + shortcut: StandardKey.ZoomIn + enabled: pageView.sourceSize.width < 10000 + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-in.svg" + onTriggered: pageView.renderScale *= root.scaleStep + } + } + ToolButton { + action: Action { + shortcut: StandardKey.ZoomOut + enabled: pageView.sourceSize.width > 50 + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-out.svg" + onTriggered: pageView.renderScale /= root.scaleStep + } + } + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-fit-width.svg" + onTriggered: pageView.scaleToWidth(root.contentItem.width, root.contentItem.height) + } + } + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-fit-best.svg" + onTriggered: pageView.scaleToPage(root.contentItem.width, root.contentItem.height) + } + } + ToolButton { + action: Action { + shortcut: "Ctrl+0" + icon.source: "../../../../examples/pdf/pdfviewer/resources/zoom-original.svg" + onTriggered: pageView.resetScale() + } + } + ToolButton { + action: Action { + shortcut: "Ctrl+L" + icon.source: "../../../../examples/pdf/pdfviewer/resources/rotate-left.svg" + onTriggered: pageView.rotation -= 90 + } + } + ToolButton { + action: Action { + shortcut: "Ctrl+R" + icon.source: "../../../../examples/pdf/pdfviewer/resources/rotate-right.svg" + onTriggered: pageView.rotation += 90 + } + } + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/go-previous-view-page.svg" + enabled: pageView.backEnabled + onTriggered: pageView.back() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "go back" + } + SpinBox { + id: currentPageSB + from: 0 + to: document.pageCount + editable: true + value: pageView.currentPage + onValueModified: pageView.goToPage(value) + + textFromValue: function(value) { return document.pageLabel(value) } + valueFromText: function(text) { + for (var i = 0; i < document.pageCount; ++i) { + if (document.pageLabel(i).toLowerCase().indexOf(text.toLowerCase()) === 0) + return i + } + return spinBox.value + } + + Shortcut { + sequence: StandardKey.MoveToPreviousPage + onActivated: pageView.goToPage(currentPageSB.value - 1) + } + Shortcut { + sequence: StandardKey.MoveToNextPage + onActivated: pageView.goToPage(currentPageSB.value + 1) + } + } + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/go-next-view-page.svg" + enabled: pageView.forwardEnabled + onTriggered: pageView.forward() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "go forward" + } + ToolButton { + action: Action { + shortcut: StandardKey.Copy + icon.source: "../../../../examples/pdf/pdfviewer/resources/edit-copy.svg" + enabled: pageView.selectedText !== "" + onTriggered: pageView.copySelectionToClipboard() + } + } + Shortcut { + sequence: StandardKey.Quit + onActivated: Qt.quit() + } + } + } + + FileDialog { + id: fileDialog + title: "Open a PDF file" + nameFilters: [ "PDF files (*.pdf)" ] + onAccepted: document.source = selectedFile + } + + Component.onCompleted: { + if (Application.arguments.length > 2) + document.source = Application.arguments[Application.arguments.length - 1] + } + + Dialog { + id: errorDialog + title: "Error loading " + document.source + standardButtons: Dialog.Ok + modal: true + closePolicy: Popup.CloseOnEscape + anchors.centerIn: parent + width: 300 + + Label { + id: errorField + text: document.error + } + } + + PdfPageView { + id: pageView + x: searchDrawer.position * searchDrawer.width // TODO binding gets broken during centering + document: PdfDocument { + id: document + source: Qt.resolvedUrl(root.source) + onStatusChanged: (status) => { if (status === PdfDocument.Error) errorDialog.open() } + } + searchString: searchField.text + onRenderScaleChanged: pageView.returnToBounds() + + DragHandler { + acceptedButtons: Qt.MiddleButton + onActiveChanged: if (!active) pageView.returnToBounds() + } + DragHandler { + acceptedDevices: PointerDevice.TouchScreen + onActiveChanged: if (!active) pageView.returnToBounds() + } + + BoundaryRule on x { + id: brx + minimumOvershoot: 100 + maximumOvershoot: 100 + minimum: Math.min(0, root.width - pageView.width) + maximum: 0 + } + + BoundaryRule on y { + id: bry + minimumOvershoot: 100 + maximumOvershoot: 100 + minimum: Math.min(0, root.height - pageView.height) + maximum: 0 + } + + function returnToBounds() { + bry.returnToBounds() + brx.returnToBounds() + } + } + + WheelHandler { + target: pageView + property: "x" + orientation: Qt.Horizontal + acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad + acceptedModifiers: Qt.NoModifier + onActiveChanged: if (!active) brx.returnToBounds() + } + WheelHandler { + target: pageView + property: "y" + orientation: Qt.Vertical + acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad + acceptedModifiers: Qt.NoModifier + onActiveChanged: if (!active) bry.returnToBounds() + } + + Drawer { + id: searchDrawer + edge: Qt.LeftEdge + modal: false + width: searchLayout.implicitWidth + y: root.header.height + height: root.contentItem.height + dim: false + Shortcut { + sequence: StandardKey.Find + onActivated: { + searchDrawer.open() + searchField.forceActiveFocus() + } + } + ColumnLayout { + id: searchLayout + anchors.fill: parent + anchors.margins: 2 + RowLayout { + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/go-up-search.svg" + shortcut: StandardKey.FindPrevious + onTriggered: pageView.searchBack() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "find previous" + } + TextField { + id: searchField + placeholderText: "search" + Layout.minimumWidth: 200 + Layout.fillWidth: true + Image { + visible: searchField.text !== "" + source: "../../../../examples/pdf/pdfviewer/resources/edit-clear.svg" + anchors { + right: parent.right + top: parent.top + bottom: parent.bottom + margins: 3 + rightMargin: 5 + } + TapHandler { + onTapped: searchField.clear() + } + } + } + ToolButton { + action: Action { + icon.source: "../../../../examples/pdf/pdfviewer/resources/go-down-search.svg" + shortcut: StandardKey.FindNext + onTriggered: pageView.searchForward() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "find next" + } + } + ListView { + id: searchResultsList + Layout.fillWidth: true + Layout.fillHeight: true + clip: true + model: pageView.searchModel + ScrollBar.vertical: ScrollBar { } + delegate: ItemDelegate { + width: parent ? parent.width : 0 + text: "page " + document.pageLabel(page) + ": " + contextBefore + pageView.searchString + contextAfter + highlighted: ListView.isCurrentItem + onClicked: { + searchResultsList.currentIndex = index + pageView.goToLocation(page, location, 0) + pageView.searchModel.currentResult = indexOnPage + } + } + } + } + } + + footer: Label { + property size implicitPointSize: document.pagePointSize(pageView.currentPage) + text: "page " + (pageView.currentPage + 1) + " of " + document.pageCount + + " scale " + pageView.renderScale.toFixed(2) + + " original " + implicitPointSize.width.toFixed(1) + "x" + implicitPointSize.height.toFixed(1) + "pts" + visible: document.status === PdfDocument.Ready + } +} diff --git a/tests/manual/quick/pdf/pessimizedListView.qml b/tests/manual/quick/pdf/pessimizedListView.qml index 4ae0edabe..1b514668e 100644 --- a/tests/manual/quick/pdf/pessimizedListView.qml +++ b/tests/manual/quick/pdf/pessimizedListView.qml @@ -1,57 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $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 +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Layouts +import QtQuick.Pdf ApplicationWindow { width: 900 @@ -127,11 +80,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 +103,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..3f39bb213 100644 --- a/tests/manual/quick/pdf/simplest.qml +++ b/tests/manual/quick/pdf/simplest.qml @@ -1,53 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.14 +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick Image { id: image diff --git a/tests/manual/quick/pdf/test.pdf b/tests/manual/quick/pdf/test.pdf Binary files differindex a9dc1bc29..0832dfbed 100644 --- a/tests/manual/quick/pdf/test.pdf +++ b/tests/manual/quick/pdf/test.pdf diff --git a/tests/manual/quick/pdf/underscoredLinks.qml b/tests/manual/quick/pdf/underscoredLinks.qml new file mode 100644 index 000000000..514008ca2 --- /dev/null +++ b/tests/manual/quick/pdf/underscoredLinks.qml @@ -0,0 +1,146 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Pdf +import QtQuick.Shapes + +ApplicationWindow { + id: root + width: 800 + height: 940 + color: "darkgrey" + title: doc.source + visible: true + + property PdfDocument doc: PdfDocument { source: "test.pdf" } + + Component.onCompleted: { + if (Application.arguments.length > 2) + doc.source = Application.arguments[Application.arguments.length - 1] + } + FileDialog { + id: fileDialog + title: "Open a PDF file" + nameFilters: [ "PDF files (*.pdf)" ] + onAccepted: doc.source = selectedFile + } + ScrollView { + anchors.fill: parent + contentWidth: paper.width + contentHeight: paper.height + + Rectangle { + id: paper + width: image.width + height: image.height + PdfPageImage { + id: image + document: doc + + property real zoomFactor: Math.sqrt(2) + + Shortcut { + sequence: StandardKey.MoveToNextPage + enabled: image.currentFrame < image.frameCount - 1 + onActivated: image.currentFrame++ + } + Shortcut { + sequence: StandardKey.MoveToPreviousPage + enabled: image.currentFrame > 0 + onActivated: image.currentFrame-- + } + Shortcut { + sequence: StandardKey.ZoomIn + enabled: image.sourceSize.width < 5000 + onActivated: { + image.sourceSize.width = image.implicitWidth * image.zoomFactor + image.sourceSize.height = image.implicitHeight * image.zoomFactor + } + } + Shortcut { + sequence: StandardKey.ZoomOut + enabled: image.width > 50 + onActivated: { + image.sourceSize.width = image.implicitWidth / image.zoomFactor + image.sourceSize.height = image.implicitHeight / image.zoomFactor + } + } + Shortcut { + sequence: "Ctrl+0" + onActivated: image.sourceSize = undefined + } + Shortcut { + sequence: StandardKey.Open + onActivated: fileDialog.open() + } + Shortcut { + sequence: StandardKey.Quit + onActivated: Qt.quit() + } + } + + Menu { + id: linkContextMenu + property var currentLink + MenuItem { + text: "Go" + onTriggered: { + if (linkContextMenu.currentLink.page >= 0) + image.currentFrame = linkContextMenu.currentLink.page + else + Qt.openUrlExternally(linkContextMenu.currentLink.url) + } + } + MenuItem { + text: "Copy" + onTriggered: linkContextMenu.currentLink.copyToClipboard() + } + } + + Repeater { + model: PdfLinkModel { + id: linkModel + document: doc + page: image.currentFrame + } + delegate: PdfLinkDelegate { + x: rectangle.x + y: rectangle.y + width: rectangle.width + height: rectangle.height + onTapped: + (link) => { + if (link.page >= 0) + image.currentFrame = link.page + else + Qt.openUrlExternally(url) + } + onContextMenuRequested: + (link) => { + linkContextMenu.currentLink = link + linkContextMenu.x = x + linkContextMenu.y = y + linkContextMenu.open() + } + Shape { + anchors.fill: parent + ShapePath { + strokeWidth: 1 + strokeColor: palette.link + strokeStyle: ShapePath.DashLine + dashPattern: [ 1, 4 ] + startX: 0; startY: height + PathLine { x: width; y: height } + } + } + } + } + } + } + Label { + anchors { bottom: parent.bottom; right: parent.right; margins: 6 } + text: "page " + (image.currentFrame + 1) + " of " + doc.pageCount + } +} diff --git a/tests/manual/quick/pdf/withdoc.qml b/tests/manual/quick/pdf/withdoc.qml index 2d82a6abf..d4bf12e29 100644 --- a/tests/manual/quick/pdf/withdoc.qml +++ b/tests/manual/quick/pdf/withdoc.qml @@ -1,58 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $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 +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Pdf +import QtQuick.Shapes Window { width: 800 @@ -64,21 +16,42 @@ Window { PdfDocument { id: doc source: "test.pdf" + 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 { + id: passwordDialog + title: "Password" + standardButtons: Dialog.Ok | Dialog.Cancel + modal: true + closePolicy: Popup.CloseOnEscape + anchors.centerIn: parent + width: 300 + + contentItem: TextField { + id: passwordField + placeholderText: qsTr("Please provide the password") + echoMode: TextInput.Password + width: parent.width + onAccepted: passwordDialog.accept() + } + onOpened: function() { passwordField.forceActiveFocus() } + onAccepted: doc.password = passwordField.text } PdfSelection { id: selection document: doc page: image.currentFrame - fromPoint: dragHandler.centroid.pressPosition - toPoint: dragHandler.centroid.position + from: dragHandler.centroid.pressPosition + to: dragHandler.centroid.position hold: !dragHandler.active } @@ -109,9 +82,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) @@ -185,7 +158,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) @@ -201,6 +174,6 @@ Window { } Text { anchors.bottom: parent.bottom - text: "page " + (image.currentFrame + 1) + " of " + doc.pageCount + text: "page " + (image.currentFrame + 1) + " of " + doc.pageCount + " label: " + doc.pageLabel(image.currentFrame) } } diff --git a/tests/manual/quick/touchbrowser/AddressBar.qml b/tests/manual/quick/touchbrowser/AddressBar.qml index 77d887f3f..6ccea3441 100644 --- a/tests/manual/quick/touchbrowser/AddressBar.qml +++ b/tests/manual/quick/touchbrowser/AddressBar.qml @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 import QtQuick import QtQuick.Controls diff --git a/tests/manual/quick/touchbrowser/CMakeLists.txt b/tests/manual/quick/touchbrowser/CMakeLists.txt new file mode 100644 index 000000000..c211ba8e6 --- /dev/null +++ b/tests/manual/quick/touchbrowser/CMakeLists.txt @@ -0,0 +1,38 @@ +if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(touchbrowser LANGUAGES CXX) + find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) +endif() + +if(NOT CMAKE_CROSSCOMPILING) + add_definitions(-DDESKTOP_BUILD) + set(SOURCES "touchmockingapplication.cpp") +endif() + +qt_internal_add_manual_test(touchbrowser + GUI + SOURCES + main.cpp + utils.h + ${SOURCES} + PUBLIC_LIBRARIES + Qt::GuiPrivate + Qt::Quick + Qt::WebEngineQuick + ENABLE_AUTOGEN_TOOLS + moc +) + +set(touchbrowser_resource_files + "AddressBar.qml" + "main.qml" + "MockTouchPoint.qml" + "touchpoint.png" +) + +qt_add_resources(touchbrowser "touchbrowser" + PREFIX + "/" + FILES + ${touchbrowser_resource_files} +) diff --git a/tests/manual/quick/touchbrowser/MockTouchPoint.qml b/tests/manual/quick/touchbrowser/MockTouchPoint.qml index bc24b002e..bdce0555c 100644 --- a/tests/manual/quick/touchbrowser/MockTouchPoint.qml +++ b/tests/manual/quick/touchbrowser/MockTouchPoint.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt WebBrowser application. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** 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) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick diff --git a/tests/manual/quick/touchbrowser/main.cpp b/tests/manual/quick/touchbrowser/main.cpp index ffbe81179..b63f3b31c 100644 --- a/tests/manual/quick/touchbrowser/main.cpp +++ b/tests/manual/quick/touchbrowser/main.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #if defined(DESKTOP_BUILD) #include "touchmockingapplication.h" diff --git a/tests/manual/quick/touchbrowser/main.qml b/tests/manual/quick/touchbrowser/main.qml index 1b864c057..83ede7d75 100644 --- a/tests/manual/quick/touchbrowser/main.qml +++ b/tests/manual/quick/touchbrowser/main.qml @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 import QtQuick import QtQuick.Layouts diff --git a/tests/manual/quick/touchbrowser/touchmockingapplication.cpp b/tests/manual/quick/touchbrowser/touchmockingapplication.cpp index 7a05567cb..4fad86d33 100644 --- a/tests/manual/quick/touchbrowser/touchmockingapplication.cpp +++ b/tests/manual/quick/touchbrowser/touchmockingapplication.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "touchmockingapplication.h" diff --git a/tests/manual/quick/touchbrowser/touchmockingapplication.h b/tests/manual/quick/touchbrowser/touchmockingapplication.h index 205cab694..3264d5a0c 100644 --- a/tests/manual/quick/touchbrowser/touchmockingapplication.h +++ b/tests/manual/quick/touchbrowser/touchmockingapplication.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef TOUCHMOCKINGAPPLICATION_H #define TOUCHMOCKINGAPPLICATION_H diff --git a/tests/manual/quick/touchbrowser/utils.h b/tests/manual/quick/touchbrowser/utils.h index b7aeefce0..605ebf23d 100644 --- a/tests/manual/quick/touchbrowser/utils.h +++ b/tests/manual/quick/touchbrowser/utils.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef UTILS_H #define UTILS_H diff --git a/tests/manual/widgets/CMakeLists.txt b/tests/manual/widgets/CMakeLists.txt new file mode 100644 index 000000000..4e619f066 --- /dev/null +++ b/tests/manual/widgets/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(inputmethods) +add_subdirectory(webgl) diff --git a/tests/manual/widgets/inputmethods/CMakeLists.txt b/tests/manual/widgets/inputmethods/CMakeLists.txt new file mode 100644 index 000000000..4bc6e76db --- /dev/null +++ b/tests/manual/widgets/inputmethods/CMakeLists.txt @@ -0,0 +1,34 @@ +if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(inputmethods LANGUAGES CXX) + find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) +endif() + +qt_internal_add_manual_test(inputmethods + GUI + SOURCES + colorpicker.cpp + controlview.cpp + main.cpp + referenceview.cpp + testview.cpp + webview.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::Test + Qt::WebEngineWidgets + ENABLE_AUTOGEN_TOOLS + moc +) + +set(inputmethods_resource_files + "testdata.csv" +) + +qt_add_resources(inputmethods "inputmethods" + PREFIX + "/" + FILES + ${inputmethods_resource_files} +) diff --git a/tests/manual/widgets/inputmethods/colorpicker.cpp b/tests/manual/widgets/inputmethods/colorpicker.cpp index ee2e2e43f..cc0840bcd 100644 --- a/tests/manual/widgets/inputmethods/colorpicker.cpp +++ b/tests/manual/widgets/inputmethods/colorpicker.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #include "colorpicker.h" diff --git a/tests/manual/widgets/inputmethods/colorpicker.h b/tests/manual/widgets/inputmethods/colorpicker.h index f5448ad2d..171c0186b 100644 --- a/tests/manual/widgets/inputmethods/colorpicker.h +++ b/tests/manual/widgets/inputmethods/colorpicker.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #ifndef COLORPICKER_H #define COLORPICKER_H diff --git a/tests/manual/widgets/inputmethods/controlview.cpp b/tests/manual/widgets/inputmethods/controlview.cpp index 4538ced4b..86bf8cca9 100644 --- a/tests/manual/widgets/inputmethods/controlview.cpp +++ b/tests/manual/widgets/inputmethods/controlview.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #include "controlview.h" @@ -69,7 +44,7 @@ ControlView::ControlView(QWidget *parent) layout->addRow(m_sendEventButton); setLayout(layout); - connect(m_sendEventButton, &QPushButton::clicked, this, &ControlView::createAndSendInputMethodEvent); + connect(m_sendEventButton, &QPushButton::clicked, this, &ControlView::requestInputMethodEvent); } void ControlView::receiveInputMethodData(int start, @@ -87,7 +62,12 @@ void ControlView::receiveInputMethodData(int start, m_inputLine->setText(input); } -void ControlView::createAndSendInputMethodEvent() +const QString ControlView::getText() const +{ + return m_inputLine->text(); +} + +const QList<QInputMethodEvent::Attribute> ControlView::getAtrributes() const { int start = m_startSpin->value(); int length = m_lengthSpin->value(); @@ -102,7 +82,6 @@ void ControlView::createAndSendInputMethodEvent() QList<QInputMethodEvent::Attribute> attrs; attrs.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, start, length, format)); - QInputMethodEvent im(m_inputLine->text(), attrs); - emit sendInputMethodEvent(im); + return attrs; } diff --git a/tests/manual/widgets/inputmethods/controlview.h b/tests/manual/widgets/inputmethods/controlview.h index 0ef10f6a8..f6b3e7fe6 100644 --- a/tests/manual/widgets/inputmethods/controlview.h +++ b/tests/manual/widgets/inputmethods/controlview.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #ifndef CONTROLVIEW_H #define CONTROLVIEW_H @@ -46,12 +21,13 @@ class ControlView : public QWidget public: explicit ControlView(QWidget *parent = 0); + const QString getText() const; + const QList<QInputMethodEvent::Attribute> getAtrributes() const; + public slots: void receiveInputMethodData(int, int, QTextCharFormat::UnderlineStyle, const QColor &, const QColor &, const QString &); - void createAndSendInputMethodEvent(); - signals: - void sendInputMethodEvent(QInputMethodEvent); + void requestInputMethodEvent(); private: QComboBox *m_underlineStyleCombo; diff --git a/tests/manual/widgets/inputmethods/main.cpp b/tests/manual/widgets/inputmethods/main.cpp index a96deb83a..2378e95ae 100644 --- a/tests/manual/widgets/inputmethods/main.cpp +++ b/tests/manual/widgets/inputmethods/main.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #include <QApplication> #include <QFormLayout> @@ -49,7 +24,12 @@ class MainWindow : public QMainWindow public: explicit MainWindow(QWidget *parent = 0); +private slots: + void sendInputMethodEvents(); + private: + void closeEvent(QCloseEvent *event) override; + ControlView *m_controlView; ReferenceView *m_referenceView; WebView *m_webView; @@ -109,29 +89,44 @@ MainWindow::MainWindow(QWidget *parent) centralLayout->addLayout(leftLayout); centralLayout->addWidget(m_testView); - connect(m_testView, &TestView::sendInputMethodData, m_controlView, &ControlView::receiveInputMethodData); - connect(m_testView, &TestView::requestInputMethodEvent, m_controlView, &ControlView::createAndSendInputMethodEvent); - - connect(m_controlView, &ControlView::sendInputMethodEvent, [=](QInputMethodEvent im) { - bool processed; - QString resultText; - - processed = QApplication::sendEvent(m_referenceView->referenceInput(), &im); - resultText = processed ? QStringLiteral("<font color='green'>TRUE</font>") - : QStringLiteral("<font color='red'>FALSE</font>"); - m_referenceProcessed->setText(resultText); - - processed = QApplication::sendEvent(m_webView->focusProxy(), &im); - resultText = processed ? QStringLiteral("<font color='green'>TRUE</font>") - : QStringLiteral("<font color='red'>FALSE</font>"); - m_webProcessed->setText(resultText); - }); + connect(m_testView, &TestView::sendInputMethodData, m_controlView, + &ControlView::receiveInputMethodData); + connect(m_testView, &TestView::requestInputMethodEvent, this, + &MainWindow::sendInputMethodEvents); + connect(m_controlView, &ControlView::requestInputMethodEvent, this, + &MainWindow::sendInputMethodEvents); centralWidget->setLayout(centralLayout); setCentralWidget(centralWidget); setWindowTitle(tr("Input Methods Format Manual Test")); } +void MainWindow::sendInputMethodEvents() +{ + bool processed; + QString resultText; + + QString text = m_controlView->getText(); + QList<QInputMethodEvent::Attribute> attrs = m_controlView->getAtrributes(); + QInputMethodEvent im(text, attrs); + + processed = QApplication::sendEvent(m_referenceView->referenceInput(), &im); + resultText = processed ? QStringLiteral("<font color='green'>TRUE</font>") + : QStringLiteral("<font color='red'>FALSE</font>"); + m_referenceProcessed->setText(resultText); + + processed = QApplication::sendEvent(m_webView->focusProxy(), &im); + resultText = processed ? QStringLiteral("<font color='green'>TRUE</font>") + : QStringLiteral("<font color='red'>FALSE</font>"); + m_webProcessed->setText(resultText); +} + +void MainWindow::closeEvent(QCloseEvent *event) +{ + m_testView->cancelTest(); + QMainWindow::closeEvent(event); +} + int main(int argc, char *argv[]) { QApplication a(argc, argv); diff --git a/tests/manual/widgets/inputmethods/referenceview.cpp b/tests/manual/widgets/inputmethods/referenceview.cpp index 906a3001e..27e784fbc 100644 --- a/tests/manual/widgets/inputmethods/referenceview.cpp +++ b/tests/manual/widgets/inputmethods/referenceview.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #include "referenceview.h" diff --git a/tests/manual/widgets/inputmethods/referenceview.h b/tests/manual/widgets/inputmethods/referenceview.h index 4025d4886..d943a93d0 100644 --- a/tests/manual/widgets/inputmethods/referenceview.h +++ b/tests/manual/widgets/inputmethods/referenceview.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #ifndef REFERENCEVIEW_H #define REFERENCEVIEW_H diff --git a/tests/manual/widgets/inputmethods/testview.cpp b/tests/manual/widgets/inputmethods/testview.cpp index 14e355caf..d57b22cc5 100644 --- a/tests/manual/widgets/inputmethods/testview.cpp +++ b/tests/manual/widgets/inputmethods/testview.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #include "testview.h" @@ -94,11 +69,19 @@ void TestView::loadTestData(const QString &testDataPath) testDataFile.close(); } +void TestView::cancelTest() +{ + if (!m_testRunning) + return; + + m_testRunning = false; + m_testButton->setText(tr("Start Test")); +} + void TestView::startOrCancelTest() { if (m_testRunning) { - m_testRunning = false; - m_testButton->setText(tr("Start Test")); + cancelTest(); return; } @@ -120,10 +103,7 @@ void TestView::startOrCancelTest() QTest::qWait(1000); } - if (m_testRunning) { - m_testRunning = false; - m_testButton->setText(tr("Start Test")); - } + cancelTest(); } void TestView::collectAndSendData() diff --git a/tests/manual/widgets/inputmethods/testview.h b/tests/manual/widgets/inputmethods/testview.h index 4934a5f87..feb512cde 100644 --- a/tests/manual/widgets/inputmethods/testview.h +++ b/tests/manual/widgets/inputmethods/testview.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #ifndef TESTVIEW_H #define TESTVIEW_H @@ -41,6 +16,8 @@ class TestView : public QWidget public: explicit TestView(QWidget *parent = 0); + void cancelTest(); + public slots: void loadTestData(const QString &); void startOrCancelTest(); diff --git a/tests/manual/widgets/inputmethods/webview.cpp b/tests/manual/widgets/inputmethods/webview.cpp index 62e210ecf..915d73a7f 100644 --- a/tests/manual/widgets/inputmethods/webview.cpp +++ b/tests/manual/widgets/inputmethods/webview.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #include "webview.h" #include <QWebEngineSettings> diff --git a/tests/manual/widgets/inputmethods/webview.h b/tests/manual/widgets/inputmethods/webview.h index be57fbf29..a46dcb2f6 100644 --- a/tests/manual/widgets/inputmethods/webview.h +++ b/tests/manual/widgets/inputmethods/webview.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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 WITH Qt-GPL-exception-1.0 #ifndef WEBVIEW_H #define WEBVIEW_H diff --git a/tests/manual/widgets/webgl/CMakeLists.txt b/tests/manual/widgets/webgl/CMakeLists.txt new file mode 100644 index 000000000..9eaa50c00 --- /dev/null +++ b/tests/manual/widgets/webgl/CMakeLists.txt @@ -0,0 +1,17 @@ +if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(webgl LANGUAGES CXX) + find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) +endif() + +qt_internal_add_manual_test(webgl + GUI + SOURCES + main.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WebEngineWidgets + ENABLE_AUTOGEN_TOOLS + moc +) diff --git a/tests/manual/widgets/webgl/main.cpp b/tests/manual/widgets/webgl/main.cpp index c18a15bac..7037c34db 100644 --- a/tests/manual/widgets/webgl/main.cpp +++ b/tests/manual/widgets/webgl/main.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module 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) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include <QtCore/QDebug> #include <QtCore/QLoggingCategory> |