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

QQmlComponent: Component is not ready



  • Hi,

    I keep receiving QQmlComponent: Component is not ready when I try to start the following qml file as dialog.

    Map qml

    I basically have mainwindow which contains a button when this button is clicked I attempt to start the map as follows:

    void MainWindow::on_openMapBtn_clicked()
    {
        QQmlEngine engine;
        QMLCommunicationAgent agent;
        engine.rootContext()->setContextProperty("agent", &agent);
        QQmlComponent component(&engine, QUrl::fromLocalFile("map.qml"));
        component.create();
    }
    

    I read some posts that suggest that the .qml file not found. So I added the .qml file to the resources file inside the / folder or perfix. I then tried

        QQmlComponent component(&engine, QUrl::fromLocalFile("qrc:/map.qml"));
    

    and

        QQmlComponent component(&engine, QUrl::fromLocalFile(":/map.qml"));
    
    

    no success.


  • Moderators

    @WhatIf Use errors to know what might have gone wrong. On a side note QQmlEngine engine will die as soon as the function exits.



  • Maybe I am totally out of line here, since I am just a Qt beginner myself, but isn't there something like "onCompleted" to hold off user interaction before the system is setup?



  • When I used errors, I got:

    module "QtPositioning" version 5.5 is not installed
    QQmlComponent: Component is not ready

    I started the Qt Maintenance Tool > Add or remove components > expanded Qt 5.5 but I didn't seem to find the package to install QtPositioning and when I select packages they don't list what is included in the package.

    Which package should I install?


  • Moderators

    @peteritv I think you need to install Qt Location as it seems they both are bound together for some reasons. See this for more info.
    Best would be to use the latest version.



  • I changed the import statements from

    import QtPositioning 5.5
    import QtLocation 5.5
    

    to

    import QtPositioning 5.2
    import QtLocation 5.2
    

    and I got past the module "QtPositioning" version 5.5 is not installed

    I ran the Qt Maintenance Tool > Add or remove components > expanded Qt 5.5>source components>add-ons and found that qtlocation 5.5.1-0 is checked.

    Any idea why this is happening?


  • Moderators

    @WhatIf Looks like there is no QtPositioning 5.5 but just 5.2
    http://doc.qt.io/qt-5/qtpositioning-index.html



  • import QtQuick 2.0
    import QtPositioning 5.5
    import QtLocation 5.6

    http://doc.qt.io/qt-5/qtlocation-places-map-example.html

    If I change

    import QtPositioning 5.5
    import QtLocation 5.6
    

    to

    import QtPositioning 5.2
    import QtLocation 5.2
    

    the program compiles fine but it doesn't display the map at all and I get

    qml: Plugin Error (osm): The service provider does not support the QPlaceManager type.

    in the application output.

    I have been trying to get the map app to work for months now with no success.


  • Moderators

    @WhatIf QPlaceManager was introduced in Qt 5.6 and you are using Qt 5.5.
    I would suggest you to update to Qt 5.6 (LTS) or Qt 5.7 since most of the problems that you encounter seems to be taken care of.


Log in to reply