Advertisement
Touch_Grass

Untitled

May 18th, 2023
1,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.56 KB | None | 0 0
  1. #include <QGuiApplication>
  2. #include <QQmlApplicationEngine>
  3. #include <QQmlContext>
  4. #include "header.h"
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.     QGuiApplication app(argc, argv);
  9.  
  10.     qmlRegisterType<MyClass>("com.example",1,0,"MyClass");
  11.  
  12.     QQmlApplicationEngine engine;
  13.  
  14.     MyClass QObject;
  15.  
  16.     const QUrl url(u"qrc:/yeppy/Main.qml"_qs);
  17.  
  18.     QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
  19.         &app, []() { QCoreApplication::exit(-1); },
  20.         Qt::QueuedConnection);
  21.     engine.load(url);
  22.  
  23.  
  24.     return app.exec();
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement