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

How to call Dialog with openfunction properly?



  • I am trying to call a dialog with open function, but I've got an error message: "Property 'open' of object C2opedi_TestComponent_QMLTYPE_48(0x141907af3f0) is not a function".
    Do you have any idea how to solve it? Thanks.

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Dialogs 1.2
    import QtQuick.Layouts 1.12
    import "qrc:/qml/public"
    import "../public"
    
    Item
    {
        id: root
        implicitWidth: 300
        implicitHeight: 100
        SystemPalette { id: palette }
        clip: true
    
        property string confirmationDialogMessage: "Do you confirm?"
        property string buttonGroupTextYes: "Yes"
        property string buttonGroupTextNo: "No"
    
    
    
        Rectangle
        {
            id: bottomBar
            anchors
            {
                left: parent.left
                right: parent.right
                bottom: parent.bottom
            }
            height: confirmationDialogButton.height * 1.2
            color: Qt.darker(palette.window, 1.1)
            border.color: Qt.darker(palette.window, 1.3)
            Row
            {
                id: confirmationDialogButton
                spacing: 6
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 12
                width: parent.width
                Button
                {
                    text: "Confirmation dialog"
                    anchors.verticalCenter: parent.verticalCenter
                    onClicked: confirmationDialog.open()
                }
            }
        }
        C2opedi_TestComponent
        {
            id: confirmationDialog
            confirmationMessage: confirmationDialogMessage
            buttonTextYes: buttonGroupTextYes
            buttonTextNo: buttonGroupTextNo
    
        }
    
    }
    

Log in to reply