Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML Image source not loading on to the screen
Forum Updated to NodeBB v4.3 + New Features

QML Image source not loading on to the screen

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 263 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    amitsgh
    wrote on 25 Aug 2023, 07:48 last edited by amitsgh
    #1

    Image.qml file -
    72fd0370-1c16-4607-8fd9-93a7b1c2ab24-image.png

    Cmake file -
    676d6048-d98f-45ea-a649-2f6ae1d15fa3-image.png

    Main.qml file -
    ae8420fc-7025-496f-ac81-611718161085-image.png

    File Structure -
    67d752a2-adf7-4515-b08b-04ca77d7e22a-image.png

    I have my image in the resources.qrc file with the path :/images/assets/icons8-rocket-94.png and url qrc:/images/assets/icons8-rocket-94.png

    I have tried the everything and still I can't get to load the image on to the screen.

    I have tried the following -

    source: "qrc:/images/assets/icons8-rocket-94.png"
    
    source: "qrc://images/assets/icons8-rocket-94.png"
    
    source: "qrc:///images/assets/icons8-rocket-94.png"
    
    source: "../assets/icons8-rocket-94.png"
    
    source: "C:/Users/username/Qt/learn_qt/qml_basics/qml_basic/assets"
    

    Window -
    e4dbd8a9-7092-402f-9f87-e138e49069fd-image.png
    still I can't able the load the image. Pls help!!

    S 1 Reply Last reply 25 Aug 2023, 08:15
    0
    • A amitsgh
      25 Aug 2023, 07:48

      Image.qml file -
      72fd0370-1c16-4607-8fd9-93a7b1c2ab24-image.png

      Cmake file -
      676d6048-d98f-45ea-a649-2f6ae1d15fa3-image.png

      Main.qml file -
      ae8420fc-7025-496f-ac81-611718161085-image.png

      File Structure -
      67d752a2-adf7-4515-b08b-04ca77d7e22a-image.png

      I have my image in the resources.qrc file with the path :/images/assets/icons8-rocket-94.png and url qrc:/images/assets/icons8-rocket-94.png

      I have tried the everything and still I can't get to load the image on to the screen.

      I have tried the following -

      source: "qrc:/images/assets/icons8-rocket-94.png"
      
      source: "qrc://images/assets/icons8-rocket-94.png"
      
      source: "qrc:///images/assets/icons8-rocket-94.png"
      
      source: "../assets/icons8-rocket-94.png"
      
      source: "C:/Users/username/Qt/learn_qt/qml_basics/qml_basic/assets"
      

      Window -
      e4dbd8a9-7092-402f-9f87-e138e49069fd-image.png
      still I can't able the load the image. Pls help!!

      S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 25 Aug 2023, 08:15 last edited by
      #2

      Image also needs a width and height.

      (Z(:^

      A 1 Reply Last reply 25 Aug 2023, 08:49
      2
      • S sierdzio
        25 Aug 2023, 08:15

        Image also needs a width and height.

        A Offline
        A Offline
        amitsgh
        wrote on 25 Aug 2023, 08:49 last edited by
        #3

        @sierdzio Thank you. It really was a silly mistake; how can I be so stupid!! 😞

        S 1 Reply Last reply 25 Aug 2023, 09:02
        0
        • A amitsgh has marked this topic as solved on 25 Aug 2023, 08:50
        • A amitsgh
          25 Aug 2023, 08:49

          @sierdzio Thank you. It really was a silly mistake; how can I be so stupid!! 😞

          S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 25 Aug 2023, 09:02 last edited by
          #4

          @amitsgh No worries, it happens to everybody. And QML is notorious for not printing enough warnings so it's easy to miss such details.

          (Z(:^

          1 Reply Last reply
          0

          1/4

          25 Aug 2023, 07:48

          • Login

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