Qt World Summit: Register Today!

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"
        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"
            id: bottomBar
                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)
                id: confirmationDialogButton
                spacing: 6
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 12
                width: parent.width
                    text: "Confirmation dialog"
                    anchors.verticalCenter: parent.verticalCenter
                    onClicked: confirmationDialog.open()
            id: confirmationDialog
            confirmationMessage: confirmationDialogMessage
            buttonTextYes: buttonGroupTextYes
            buttonTextNo: buttonGroupTextNo

Log in to reply