summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/adding/main.cpp
blob: 7e5cbef0b2369b9fa03f3c4d9da5afced2d82f67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <QCoreApplication>
#include <QmlEngine>
#include <QmlComponent>
#include <QDebug>
#include "person.h"

int main(int argc, char ** argv)
{
    QCoreApplication app(argc, argv);

    QmlEngine engine;
    QmlComponent component(&engine, ":example.qml");
    Person *person = qobject_cast<Person *>(component.create());
    if (person) {
        qWarning() << "The person's name is" << person->name();
        qWarning() << "They wear a" << person->shoeSize() << "sized shoe";
    } else {
        qWarning() << "An error occured";
    }

    return 0;
}