Qml: Access to a qml slot from a plugin



  • Hello everyone,
    Currently I have project (an qml application) and a plugin. The application has a view and user clicks on the view and on Pressed slot is called.

    Scene.qml 
    Item{
    id: scene
    MouseArea {
    onPressed:console.info("clicked");
    }
    }
    main.cpp
    ...
    rootContext->setContextProperty("QmlEngine", &engine); // Top layer engine
    engine.load("Application.qml");
    
    plugin.qml
    Item{
    onPressed:console.info("From application??")
    }
    

    Now I have a plugin (it is a C++ and Qml application and uses a interface provided by the project to load) and this plugin must receive the onPressed event. Can i use the "QmlEngine" to find the component in my plugin qml or is there any other way ? The goal is to create geometry shapes from the plugin on the application scene. I have simplified the above code to keep it minimal.


Log in to reply