How I do to run Maroon In Trouble example?
-
Hi. Is there anyone who can run Maroon in Trouble? I downloaded the source code from examples in Qt Creator and I changed the code from main.cpp to the next (the original code doesn't find shared.h):
/*#include "../../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(demos/maroon/maroon)*/ #include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/demos/maroon/maroon.qml"))); return app.exec(); }I copied the code from the documentation file by file and it still not working.
I use Qt-Creator 3.4.1 and Qt 5.4.2 on Kubuntu 14.04. What am I doing bad?
-
Hi. Is there anyone who can run Maroon in Trouble? I downloaded the source code from examples in Qt Creator and I changed the code from main.cpp to the next (the original code doesn't find shared.h):
/*#include "../../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(demos/maroon/maroon)*/ #include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/demos/maroon/maroon.qml"))); return app.exec(); }I copied the code from the documentation file by file and it still not working.
I use Qt-Creator 3.4.1 and Qt 5.4.2 on Kubuntu 14.04. What am I doing bad?
Hi @Cold_Distance,
QQmlApplicationEngineunlikeQQuickViewdoes not automatically create a root window which means you have to create aWindoworApplicationWindowin the QML file.
The file which you are loadingmaroon.qmldoes not contain aWindoworApplicationWindowas root but contains andItemas root. SoQQmlApplicationEnginewill fail here.
To rectify it you will either need to addWindowto QML OR useQQuickViewload that QML.
UsingQQuickViewinstead ofQQmlApplicationEnginein this case will be faster with minimal changes.