Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Tutorial "Introduction to Qt Quick Controls", Fallen at first hurdle.
Forum Updated to NodeBB v4.3 + New Features

Tutorial "Introduction to Qt Quick Controls", Fallen at first hurdle.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 207 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JWalters55
    wrote last edited by
    #1

    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/HomeControls

    I 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?

    Christian EhrlicherC 1 Reply Last reply
    0
    • J JWalters55

      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/HomeControls

      I 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?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote last edited by
      #2

      @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 assets and the filename which for sure should not be there.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • J Offline
        J Offline
        JWalters55
        wrote last edited by
        #3

        Rather missed the point, that's just a typo in the post. Please give me some credit!!

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JWalters55
          wrote last edited by
          #4

          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?

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote last edited by
            #5

            You should read https://doc.qt.io/qt-6/resources.html to learn about the Qt resource system

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            1
            • J Offline
              J Offline
              JWalters55
              wrote last edited by
              #6

              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.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved