Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

why qml can't read the function



  • ApplicationWindow {

    id:window
    visible: true
    width: 640
    height: 480
    title: qsTr("Open Picture")
    
    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("&Open")
                onTriggered: fileDialoge.open()
            }
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }
    
    function imageUrl(text)
    {
        console.log("Url: " + text);
    }
    
    FileDialog {
                id: fileDialoge
                nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ]
                selectedNameFilter: "Image files (*.png *.jpg)"
                selectMultiple: true
                }
    Button {
        text: "Open"
        anchors.verticalCenter: parent.verticalCenter
        onClicked: fileDialoge.open()
    
         }
    Button {
        x: 136
        text: "Send"
        anchors.verticalCenterOffset: 0
        anchors.verticalCenter: parent.verticalCenter
        onClicked: window.imageUrl(FileDialog.fileUrl)
    
         }
    

    }



  • Hi,
    Please explain exactly what is the problem


Log in to reply