Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How can I use Qt3D and traditional QML together?

How can I use Qt3D and traditional QML together?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 2 Posters 1.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aktay
    wrote on last edited by A Former User
    #1

    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.

    ? 1 Reply Last reply
    0
    • A aktay

      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.

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Do you want to embed the images into the 3D scene, or do you need a 2D overlay on top of the 3D scene?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aktay
        wrote on last edited by
        #3

        Hi,
        I want use png and make image animation (rotate,propery animation etc..) I will also do 3D animation with them.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Okay. In this case, you need to render your image into a texture and apply the texture to a mesh.

          1 Reply Last reply
          1
          • A Offline
            A Offline
            aktay
            wrote on last edited by
            #5

            Would you show me a simple example of how I should do it?

            Thank you.

            ? 1 Reply Last reply
            0
            • A aktay

              Would you show me a simple example of how I should do it?

              Thank you.

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              @aktay Sorry, I don't have the needed Qt3D skills for that :(

              A 1 Reply Last reply
              0
              • ? A Former User

                @aktay Sorry, I don't have the needed Qt3D skills for that :(

                A Offline
                A Offline
                aktay
                wrote on last edited by
                #7

                @Wieland Okay. Thank you for your help.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved