I can not import Qt3D into an existing project



  • I am trying to add a 3D view to the Neptune UI project. In the .pro file I set these QT variables:

    TEMPLATE = subdirs
    QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
    SUBDIRS = plugins/datasource \
              plugins/screenManager
    
    qml.files = apps modules sysui i18n am-config.yaml Main*.qml
    INSTALLS += qml
    

    I set the QML_IMPORT_TRACE environment variable to 1 and see the following when I attempt run the app:

    [DBG  | default] QQmlImportDatabase::addImportPath: "/usr/lib/x86_64-linux-gnu/qt5/qml"                                                                    [:0]
    [DBG  | default] QQmlImportDatabase::addImportPath: "/usr/local/Qt-5.7.0/include"                                                                          [:0]
    [DBG  | default] QQmlImportDatabase::addImportPath: "/usr/local/bin"       [:0]
    [DBG  | default] QQmlImportDatabase::setImportPathList: ("/usr/local/bin", "/usr/local/Qt-5.7.0/include", "/usr/lib/x86_64-linux-gnu/qt5/qml", "/home/aras/Projects/UI/imports/shared", "/home/aras/Projects/UI/imports/system") [:0]
    [CRIT | am.system] WARNING: could not register service org.freedesktop.Notifications on D-Bus (unix:abstract=/tmp/dbus-c9i1pNpEVT):                        [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::addLibraryImport: "QtQuick" 2.5 as "QQ2"                                        [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::importExtension: loaded "/usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick.2/qmldir"    [:0]
    [DBG  | default] QQmlImportDatabase::registerPluginTypes: "QtQuick" from "/usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick.2"                                     [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::addLibraryImport: "QtQuick.Window" 2.2 as ""                                    [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::importExtension: loaded "/usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Window.2/qmldir"                                                                             [:0]
    [DBG  | default] QQmlImportDatabase::registerPluginTypes: "QtQuick.Window" from "/usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Window.2"                       [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::addFileImport: "sysui" -1.-1 as ""                                              [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::addLibraryImport: "controls" 1.0 as ""                                          [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::importExtension: loaded "/home/aras/Projects/UI/imports/shared/controls/qmldir"                                                                            [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::addLibraryImport: "utils" 1.0 as ""                                             [:0]
    [DBG  | default] QQmlImports(file:///home/aras/Projects/UI/Main.qml)::importExtension: loaded "/home/aras/Projects/UI/imports/shared/utils/qmldir"                                                                               [:0]
    [WARN | default] QQmlApplicationEngine failed to load component            [:0]
    [WARN | default] file:///home/aras/Projects/UI/Main.qml:6 module "Qt3D.Core" is not installed
                                                                               [:0]
    [CRIT | am.system] ERROR: Qml scene does not have a root object            [:0]
    

    Inside the main.qml file I attempt to import the 3D libraries I need:

    import Qt3D.Core 2.0
    import Qt3D.Render 2.0
    

    Yet, when I try to run the application, I get these errors:

    ...module "Qt3D.Render" is not installed
    ...module "Qt3D.Core" is not installed
    

    I thought that is all I needed to do. What am I missing here?



  • Try running one of the example Qt3D QML projects. If they dont work or you cant find any Qt3D examples then its safe to say the Qt3D module isnt installed (It should be a default package in Qt 5.7 however). Try reinstalling Qt after to see if the issue is fixed.

    This is what the examples list looks like when i search for "qt3d":
    qt3dexamples.png


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.