I have a qml file , here is the source code:
import QtQuick 2.0
Image
{
id: imageIcon;
width: 100;
height: 100;
source: 'C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg';
}
When I display it on a QQuickView i get this error:
QML Image: Protocol "c" is unknown
I am running the code on Windows 7 if it is relevant.
What is the correct format of the url?
Looks like source must use a correctly formatted URL : it's either expecting a file://
scheme or a qrc://
(for stuff inside Qt resources)
Parsing of your files tries to use a "C" protocol (from C:/) which is unknown : try
source: 'file:///C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg';
See : http://harmattan-dev.nokia.com/docs/platform-api-reference/xml/daily-docs/libqt4/qml-url.html
Usually you want to have your images relative (deployed near your app) or embedded into resources, not references absolutely as this will break deployment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With