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. source: keyword not working in Linux
Forum Updated to NodeBB v4.3 + New Features

source: keyword not working in Linux

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 191 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.
  • C Offline
    C Offline
    Colins2
    wrote on 30 May 2023, 06:49 last edited by Colins2
    #1

    I have a strange problem with QML.
    I am following a course, so copying, typing code from a book.
    The issue I have is loading an image from a resource file using the following:
    Image{
    x: y: width: height (as required)
    source: "qrc:/file.png"
    }
    This does not work. I can load a file from disk, load a file from the internet without problems, just not from the resource file.
    This problem is only on Linux Mint using Qt 6.5.1. It also happened with Qt 6.4.3 before the upgrade
    I have created the same file on my MacBook using Qt 6.1.3 and it all works fine.
    Using Qt and creating a C++ program, I can load images from a resource file on any platform. This just sems to be a QML / Linux issue.

    C 1 Reply Last reply 2 Jun 2023, 11:21
    0
    • C Colins2
      30 May 2023, 06:49

      I have a strange problem with QML.
      I am following a course, so copying, typing code from a book.
      The issue I have is loading an image from a resource file using the following:
      Image{
      x: y: width: height (as required)
      source: "qrc:/file.png"
      }
      This does not work. I can load a file from disk, load a file from the internet without problems, just not from the resource file.
      This problem is only on Linux Mint using Qt 6.5.1. It also happened with Qt 6.4.3 before the upgrade
      I have created the same file on my MacBook using Qt 6.1.3 and it all works fine.
      Using Qt and creating a C++ program, I can load images from a resource file on any platform. This just sems to be a QML / Linux issue.

      C Offline
      C Offline
      Colins2
      wrote on 2 Jun 2023, 11:21 last edited by
      #2

      Solved!
      I needed to add the line set(CMAKE_AUTORCC ON) in the CMake file and it worked fine after that

      1 Reply Last reply
      0
      • C Colins2 has marked this topic as solved on 2 Jun 2023, 11:22

      1/2

      30 May 2023, 06:49

      • Login

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