Import causes QML Item to not load
Unsolved
QML and Qt Quick
-
Hello! I have a weird problem - whenever I'm trying to import my C++ "backend" to QML, the QML GUI doesn't even load.
I have an application that launches
loader.qml
from C++, which source isstackview.qml
.Loader QML:
import QtQuick import QtQuick.Window Window { id: window width: 800 height: 480 visible: true color: "#000000" title: qsTr("Test") Loader { id: mainLoader anchors { left: parent.left right: parent.right top: parent.top bottom: parent.bottom } source: "stackview.qml" } }
Stackview QML
import QtQuick import QtQuick.Controls import MyApp.Backend // If I comment this out, everything works Item { anchors.fill: parent StackView { id: mainStackview anchors.fill: parent initialItem: "screen_main.qml" Connections { target: cppStackview onChangeScreen: { console.log("Screen change to : " + screen_url) mainStackview.push(screen_url) } } } }
Keep in mind, that I'm using
import MyApp.Backend
in other QML files and it works fine. I guess it's because it's the first .qml file that's being loaded? There are no logs from Qt on this - it simply shows blank screen. -
Try running your application with the
QML_IMPORT_TRACE
set to 1 and look at the messages in the console.