Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › Getting path from ImagePicker

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21480

    Gabor

    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.

    #21494

    Alex
    Felgo Team
Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded