[英]Protocol C is unknown error in qml
I have a qml file , here is the source code: 我有一个qml文件,这里是源代码:
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: 当我在QQuickView上显示它时出现此错误:
QML Image: Protocol "c" is unknown
QML图像:协议“c”未知
I am running the code on Windows 7 if it is relevant. 如果相关,我在Windows 7上运行代码。
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) 看起来源必须使用格式正确的URL:它要么是期望
file://
scheme,要么是qrc://
(对于Qt资源中的东西)
Parsing of your files tries to use a "C" protocol (from C:/) which is unknown : try 解析您的文件尝试使用“C”协议(来自C:/),这是未知的:尝试
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 请参阅: 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. 通常,您希望将图像相对(部署在应用程序附近)或嵌入到资源中,而不是绝对引用,因为这会破坏部署。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.