How can I use Qt3D and traditional QML together?
Unsolved
QML and Qt Quick
-
Hi All,
I want to change the question. How can I edit the main.cpp file to use Qml3d and traditional qml together?
The main.cpp I'm using for this traditional qml
#include <QApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
This is the main.cpp for qml3d
#include <Qt3DQuickExtras/qt3dquickwindow.h> #include <Qt3DQuick/QQmlAspectEngine> #include <QGuiApplication> #include <QQmlEngine> #include <QQmlContext> #include <QQuickView> int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); Qt3DExtras::Quick::Qt3DQuickWindow view; view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); view.setSource(QUrl("qrc:/main.qml")); view.show(); return app.exec(); }
Thanks.
-
Do you want to embed the images into the 3D scene, or do you need a 2D overlay on top of the 3D scene?
-
Okay. In this case, you need to render your image into a texture and apply the texture to a mesh.
-
@Wieland Okay. Thank you for your help.