3d scene not showing in dynamically loaded component
-
So I've been trying to make an application in Qt that will eventually be used in an infotainment system for a car. I'm doing it in Qt5 because this is what the platform will support.
I wanted to start the application in C++ because it will eventually be running on an embedded system and needs to be tightly integrated with various parts of the system. Also so that I can take advantage of some platform-specific features later on. I also want to use QML because it'll be way easier to create a good looking interface.
This is basically what I've done:
I have a "scenemanager" class, which is a subclass of QQuickCanvas (which might have changed name to QQuickWindow in the newest qt5) which is responsible for creating new views. It does this by using an incubationcontroller to load a qqmlcomponent.
Each of these qqmlcomponents is loaded from a qml file, and then added to the QQuickCanvas's rootItem when it should be shown. (I also added a subclass of QObject with certain properties and Q_Invokable methods as a context object when the qml 'view' is created)
The reasoning behind my doing it this way is that the qmlcomponents can be loaded dynamically in the background, and also that the background QObjects can keep track of data models and such.
If I load a 3d scene as the qml file as the very first 'view', it works just fine. However, if I start at a different 'view' and then switch to the 3d scene it doesn't work at all... Also, I can switch between all sorts of views (including particles) just fine as long as I don't use a viewport.
I can post code if needed. I realize that this isn't necessarily the suggested way of doing things.. But there isn't a whole lot of documentation on how to do something like this.
Thanks for the help!!