123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include <QGuiApplication>
- #include <QGuiApplication>
- #include <QQmlApplicationEngine>
- #include <QQmlContext>
- #include "addressbookengine.h"
- #include "addressbook.qpb.h"
- #include <QMetaProperty>
- #include <QQmlPropertyMap>
- using namespace qtprotobuf::examples;
- int main(int argc, char *argv[])
- {
- QtProtobuf::qRegisterProtobufTypes();
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- qmlRegisterType<ContactsListModel>("examples.addressbook", 1, 0, "ContactsListModel");
- QGuiApplication app(argc, argv);
- AddressBookEngine abEngine;
- QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("abEngine", &abEngine);
- engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
- if (engine.rootObjects().isEmpty())
- return -1;
- return app.exec();
- }
|