Hi,
I am using ImagePicker to choose an image and get the image path to pass it to a QQuickImageProvider. I have the following code:
import Felgo 3.0
import QtQuick 2.11
import QtQuick.Dialogs 1.2
App {
id: app
NavigationStack {
Page {
title: qsTr("Image Converter")
IconButton {
id: enlarge
visible: false
color: "blue"
icon: IconType.arrowsalt
anchors.baseline: button.baseline
anchors.right: button.left
onClicked: {
PictureViewer.show(app, image.source)
}
}
AppButton {
id: button
anchors.horizontalCenter: imageViewer.horizontalCenter
anchors.bottom: imageViewer.top
text: "Choose Image"
onClicked: {
nativeUtils.displayImagePicker("Choose the Friend's Image")
}
}
Rectangle {
id: imageViewer
width: 250
height: 250
anchors.centerIn: parent
AppImage {
id: image
onStatusChanged: if (image.status == Image.Ready)
enlarge.visible = true
anchors.fill: parent
width: 250
height: 250
autoTransform: true
fillMode: Image.PreserveAspectFit
}
}
Connections {
target: nativeUtils
onImagePickerFinished: {
if (accepted) {
var path
image.source = "image://pix/path"
console.log("The path in main.qml: ", path)
}
}
}
}
}
}
How can I get the image path from the ImagePicker?
Thank you for your help.