From df95c83edabf6db1e23559387eacb9c8e3eeb025 Mon Sep 17 00:00:00 2001 From: Thomas Gervaise <106674075+thomasgervaise-pix4d@users.noreply.github.com> Date: Mon, 13 Jun 2022 10:48:39 +0200 Subject: [PATCH] Fixes for image-viewer chapter - Platform was not suffixed to elements belonging to to Qt.labs.platform, causing ReferenceError at runtime - FileDialog's interface specifies that url is the correct member to be used to retrieve an image URL, current code causes error - The image showing the about dialog doesn't match the code of the about dialog provided. Set modal to true and aligned center with the parent. --- docs/ch06-controls/image-viewer.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/ch06-controls/image-viewer.md b/docs/ch06-controls/image-viewer.md index e825653a..2440079c 100644 --- a/docs/ch06-controls/image-viewer.md +++ b/docs/ch06-controls/image-viewer.md @@ -98,15 +98,15 @@ ApplicationWindow { // ... - FileDialog { + Platform.FileDialog { id: fileOpenDialog title: "Select an image file" - folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) + folder: Platform.StandardPaths.writableLocation(Platform.StandardPaths.DocumentsLocation) nameFilters: [ "Image files (*.png *.jpeg *.jpg)", ] onAccepted: { - image.source = fileOpenDialog.fileUrl + image.source = fileOpenDialog.file } } @@ -163,6 +163,8 @@ ApplicationWindow { Dialog { id: aboutDialog + modal: true + anchors.centerIn: parent title: qsTr("About") Label { anchors.fill: parent @@ -170,7 +172,7 @@ ApplicationWindow { horizontalAlignment: Text.AlignHCenter } - standardButtons: StandardButton.Ok + standardButtons: Platform.StandardButton.Ok } // ...