Component is not ready message



  • Hi,
    I'm trying to load busyIndicator from Qt Quick.
    My qml file:

    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtQuick.Window 2.2
    
    ApplicationWindow {
        id: windowView
        width: 100
        height: 100
        visible: true
    
        modality: Qt.ApplicationModal
        color: "#00000000"
        flags: Qt.FramelessWindowHint | Qt.WA_TranslucentBackground
    
        BusyIndicator {
           id: busyIndication
           anchors.centerIn: parent
        }
    }
    

    main.cpp:

    #include "busytest.h"
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QQmlProperty>
    #include <QQmlEngine>
    #include <QQmlComponent>
    #include <QFile>
    #include <QObject>
    #include <QQuickView>
    
    int main(int argc, char* argv[]) {
      QGuiApplication app(argc, argv);
    
    //  QQmlApplicationEngine engine;
    //  engine.load(QUrl(QStringLiteral("qrc:/busy/main.qml")));
    //  if (engine.rootObjects().isEmpty())
    //    return -1;
    
      QQmlEngine engine;
      QQmlComponent component(&engine, QUrl::fromLocalFile ("qrc:/busy/main.qml"));
      QObject* object = component.create ();
    
      delete object;
      return app.exec();
    }
    
    

    I get no error message when I build the project, but when I run it it always says QQmlComponent: Component is not ready and nothing happens. The section commented out in main.cpp works fine. What is wrong with the second version?
    Thank you for your help.


Log in to reply
 

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