Tutorial "Introduction to Qt Quick Controls", Fallen at first hurdle.
-
I’m absolutely new to QT and am working through the first tutorial “HomeControls”. I have followed the tutorial religiously but am persistently getting the error;
1: Cannot open: qrc:/qt/qml/HomeControls/assets /BrushedMetal.jpg.
Or
2 & 3: Cannot open: qrc:/qt/qml/HomeControls /BrushedMetal.jpg.I’ve tried the following;
1: Created a folder ‘assets’ in the project folder and put a copy of BrushedMetal.jpg there ({$PROJECTS}/HomeControls/assets/ BrushedMetal.jpg).
2: Put a copy of BrushedMetal.jpg in the { $PROJECTS }/‘HomeControls’ project folder itself and removed ‘assets/’ from the line ‘image{ source:’
3: Put a copy of BrushedMetal.jpg into { $PROJECTS }/HomeControsl/build/Desktop_Qt_6_10_0-Debug/HomeControlsI cannot find were ’qrc:’ is defined. I’ve looked in the .qrc file in the ../HomeControl/build/Desktop_Qt_6_10_0-Debug/HomeControls and find an alias for /qt/qml/HomeControls but unfortunately that doesn’t make much sense to me. Still can’t see how grc: is defined or to what it refers.
I’m using QT6 with QT Creator 18 on a Raspberry Pi running Debian 13 (Trixie) from a hard drive (No SD cards involved). Qt is installed on the local hard drive and my project files are located on a share on my NAS. $PROJECTS refers to the NAS share mounted under cifs at /home/john/Projects
What am I missing?
-
I’m absolutely new to QT and am working through the first tutorial “HomeControls”. I have followed the tutorial religiously but am persistently getting the error;
1: Cannot open: qrc:/qt/qml/HomeControls/assets /BrushedMetal.jpg.
Or
2 & 3: Cannot open: qrc:/qt/qml/HomeControls /BrushedMetal.jpg.I’ve tried the following;
1: Created a folder ‘assets’ in the project folder and put a copy of BrushedMetal.jpg there ({$PROJECTS}/HomeControls/assets/ BrushedMetal.jpg).
2: Put a copy of BrushedMetal.jpg in the { $PROJECTS }/‘HomeControls’ project folder itself and removed ‘assets/’ from the line ‘image{ source:’
3: Put a copy of BrushedMetal.jpg into { $PROJECTS }/HomeControsl/build/Desktop_Qt_6_10_0-Debug/HomeControlsI cannot find were ’qrc:’ is defined. I’ve looked in the .qrc file in the ../HomeControl/build/Desktop_Qt_6_10_0-Debug/HomeControls and find an alias for /qt/qml/HomeControls but unfortunately that doesn’t make much sense to me. Still can’t see how grc: is defined or to what it refers.
I’m using QT6 with QT Creator 18 on a Raspberry Pi running Debian 13 (Trixie) from a hard drive (No SD cards involved). Qt is installed on the local hard drive and my project files are located on a share on my NAS. $PROJECTS refers to the NAS share mounted under cifs at /home/john/Projects
What am I missing?
@JWalters55 said in Tutorial "Introduction to Qt Quick Controls", Fallen at first hurdle.:
qrc:/qt/qml/HomeControls/assets /BrushedMetal.jpg
There is a space between
assetsand the filename which for sure should not be there. -
Rather missed the point, that's just a typo in the post. Please give me some credit!!
-
it's the definition/declaration of qrc: I'm looking for. The alias /qt/qml pertains to the build folder but;
1: How does appHomeControls_qml_module_dir_map.qrc get built
2: Where on earth does the URL prefix 'qrc:' come from? -
You should read https://doc.qt.io/qt-6/resources.html to learn about the Qt resource system
-
OK, one learns from ones mistakes. It appears that the CMakeLists.txt file autogenerated by Qt Creator hadn't included the RESOURCES element of 'qt_add_qml_module()'. Was this something I missed when configuring the project initially or is it something that must be added manually as the project evolves? This doesn't even come over clearly in the documentation, CMakeLists.txt doesn't even get a mention.