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

<Solved> Is there any constructor function for Components ? Or Init ?



  • Hi,

    I would know if there is any constructor or initialisation function in QML ? an entrypoint at application start.

    I can make this by calling it from c++ but I cannot believe its does not exist !

    Is there anybody know ?



  • Please read document about "Defining QML Types from C++". "Any QObject-derived C++ class can be registered as the definition of a QML object type. Once a class is registered with the QML type system, the class can be declared and instantiated like any other object type from QML code."

    QML objects are created by QML engine according to QML documents.

    "QML Engine Internals, Part 1: QML File Loading":http://www.kdab.com/qml-engine-internals-part-1-qml-file-loading/



  • Will this be of any help? It's not clear what you exactly need.

    @Item {
    Component.onCompleted: {
    // extra init here
    }
    }@



  • Thanks for answering, Sergei that was what I've been looking for, but actually I have found a different way to do it.


Log in to reply