Advertisement
Guest User

main.cpp

a guest
Mar 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <QGuiApplication>
  2. #include <QQmlApplicationEngine>
  3. #include <QQmlContext>
  4.  
  5. #include "list.h"
  6. #include "modcontroller.h"
  7.  
  8. int main(int argc, char *argv[])
  9. {
  10.     QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  11.  
  12.     QGuiApplication app(argc, argv);
  13.  
  14.  
  15.     QQmlApplicationEngine engine;
  16.  
  17.  
  18.     modcontroller controller;
  19.     engine.rootContext()->setContextProperty("myModel", QVariant::fromValue(controller.getList()));
  20.     engine.rootContext()->setContextProperty("controller",&controller);
  21.  
  22.     engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
  23.     if (engine.rootObjects().isEmpty())
  24.         return -1;
  25.  
  26.  
  27.  
  28.     return app.exec();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement