[GH-ISSUE #58] the example code on the front page gives compilation errors #30

Closed
opened 2026-05-05 11:00:08 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @rtaycher on GitHub (Aug 13, 2018).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/58

I think

using (var app = new QGuiApplication(r))
{
    using (var engine = new QQmlApplicationEngine())
    {
        // Register our new type to be used in Qml
        QQmlApplicationEngine.RegisterType<QmlType>("test", 1, 1);
        engine.loadFile("main.qml");
        return app.exec();
    }
}

should be

using (var app = new QGuiApplication(args))
{
    using (var engine = new QQmlApplicationEngine())
    {
        // Register our new type to be used in Qml
        QQmlApplicationEngine.RegisterType<QmlType>("test", 1, 1);
        engine.LoadData("main.qml");
        app.Exec();
    }
}
Originally created by @rtaycher on GitHub (Aug 13, 2018). Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/58 I think ```c# using (var app = new QGuiApplication(r)) { using (var engine = new QQmlApplicationEngine()) { // Register our new type to be used in Qml QQmlApplicationEngine.RegisterType<QmlType>("test", 1, 1); engine.loadFile("main.qml"); return app.exec(); } } ``` should be ```c# using (var app = new QGuiApplication(args)) { using (var engine = new QQmlApplicationEngine()) { // Register our new type to be used in Qml QQmlApplicationEngine.RegisterType<QmlType>("test", 1, 1); engine.LoadData("main.qml"); app.Exec(); } } ``` ```
Author
Owner

@pauldotknopf commented on GitHub (Aug 13, 2018):

Yup, fixed. Thanks.

<!-- gh-comment-id:412450058 --> @pauldotknopf commented on GitHub (Aug 13, 2018): Yup, fixed. Thanks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/qmlnet#30
No description provided.