Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

Conversation

dragly
Copy link

@dragly dragly commented Feb 22, 2016

Add vendor.h with qpm::init(app, engine) that initializes each plugin listed in qpm.json.
Each plugin must be listed with the name of the C++ class and the uri this class expects in registerTypes. Each header needed for these classes must also be listed in qpm.json:

    "headers": [
      "src/mymoduleplugin.h"
    ],
    "plugins": [
      {"class": "MyModulePlugin", "uri": "MyModule"}
    ]

In main.cpp:

#include <QGuiApplication>
#include <QQmlApplicationEngine>

#include <vendor.h>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    qpm::init(app, engine);
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}

For readability in the pull request, this commit has excessive whitespace in the vendor.h template. This should be fixed later.

The implementation is similar to the proposal mentioned here:
https://trello.com/c/jvIlnOAM/8-add-some-convenience-code-for-registering-modules

PS: This is my first attempt at coding in Go. Please excuse any lack of proper style :)

Add vendor.h with qpm::init(app, engine) that initializes
each plugin listed in qpm.json.
Each plugin must be listed with the name of the C++ class
and the uri this class expects in registerTypes.
Each header needed for these classes must also be listed
in qpm.json:

    "headers": [
      "src/mymoduleplugin.h"
    ],
    "plugins": [
      {"class": "MyModulePlugin", "uri": "MyModule"}
    ]
@dragly dragly force-pushed the cpp-plugin-support branch from 6392cf0 to b6c76e5 Compare February 22, 2016 18:00
@dragly dragly mentioned this pull request Feb 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant