source: keyword not working in Linux
-
wrote on 30 May 2023, 06:49 last edited by Colins2
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. -
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.wrote on 2 Jun 2023, 11:21 last edited bySolved!
I needed to add the line set(CMAKE_AUTORCC ON) in the CMake file and it worked fine after that -
1/2