Reputation: 5926
I am trying to add 3D capabilities to my existing Qt application. In my project.pro
file I set the QT variable:
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
Edit: I set the QML_IMPORT_TRACE
environment variable to 1
. Now I 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]
Qt is installed in /usr/local/Qt-5.7.0
:
$ which qml
/usr/local/Qt-5.7.0/bin//qml
aras@aras-T900:~$ which qmake
/usr/local/Qt-5.7.0/bin//qmake
Inside my .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 my 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?
Upvotes: 1
Views: 3388
Reputation: 5926
I got 3D working in my qt app by checking out the latest source code from qt and building it. Then when I ran into missing module problems, I build the corresponding module. In the case of 3D, this is what I did:
cd qt3d
../qtbase/bin/qmake ../../qt5/qt3d
make -j5
This is assuming an out of source directory build. Source code is inside qt5
directory. Hope this helps someone.
Upvotes: 3