using QML Pages as items in main.qml
-
Hi,
I used to be able to make my qml page, for example
Can.qml
. Then I would call this whole qml as a item inmain.qml
to be able to access variable created inmain.qml
inCan.qml
:Can { id: can_page visible: false }
Now for some reason, I get this error:
qrc:/Test_Project_Display/main.qml:41:5: Can is not a type
How can I fix this? -
Hi @MaximBozek,
This issue may be caused by Can.qml not being added to qml.qrc. When a new QML file is created, it should automatically be included in the resource file(qml.qrc). If it is missing, you may encounter the error: "Can is not a type".
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>Can.qml</file>
</qresource>
</RCC> -
Hi, sorry for replying so late, been busy with other projects in the mean time. My project has this strcuture:
there is no such
qml.qrc
file in my project. I tried putting a new .qml file in that same folder asmain.qml
, but this didn't work either. -
This post is deleted!
-
@MaximBozek If there is no qrc file, create one and add qrc file to your project. Add all qml files into the qrc file.
you may need a few, for example, one for images, one for qml files and one for xml files, etc.