Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QGuiApplication>
- #include <QQmlApplicationEngine>
- #define TRY_Q_NAMESPACE
- #ifdef TRY_Q_NAMESPACE
- namespace MyNamespace {
- Q_NAMESPACE
- enum class SomeEnum {
- Foo,
- Bar
- };
- Q_ENUM_NS(SomeEnum)
- }
- #endif
- int main(int argc, char *argv[])
- {
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine;
- #ifdef TRY_Q_NAMESPACE
- qmlRegisterUncreatableMetaObject(MyNamespace::staticMetaObject,
- "com.kdab.namespace",
- 3, 14,
- "MyNamespace",
- "Error: only enums");
- #endif
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- if (engine.rootObjects().isEmpty())
- return -1;
- return app.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement