"Type Dialog unavailable" in Qt 5.9



  • I use Qt Quick Dialog on my Android app, and the app quits as soon as I run it with the following error:

    W libAppTest.so: (null):0 ((null)): QQmlApplicationEngine failed to load component
    W libAppTest.so: (null):0 ((null)): qrc:/main.qml:35 Type Dialog unavailable
    W libAppTest.so: file:///data/data/org.qtproject.example.AppTest/qt-reserved-files/qml/QtQuick/Dialogs/DefaultDialogWrapper.qml:45 "qml": no such directory
    

    Here is my source code:

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    import QtQuick.Dialogs 1.2
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        Page {
            Label {
                text: qsTr("Hello")
                anchors.centerIn: parent
    
                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        dialog.open();
                    }
                }
            }
        }
    
        Dialog {
            id: dialog
            title: "Title"
        }
    }
    

    How do I get it to work?


  • Moderators

    @kimdata Perhaps it's related to QTBUG-60918.



  • @kimdata Can you use the Dialog which is directly in Controls since 2.1? Just delete import ...Dialogs 1.2 and change import ...Controls 2.2. (version 2.2 is used in the current 5.9 documentation.)



  • @Eeli-K Thanks. I removed import QtQuick.Dialogs 1.2, modified to import QtQuick.Controls 2.2 and it works.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.