Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 为什么图像没有';门开不开?_Image_Qml_Qtquick2 - Fatal编程技术网

Image 为什么图像没有';门开不开?

Image 为什么图像没有';门开不开?,image,qml,qtquick2,Image,Qml,Qtquick2,我已使用Q_属性在我的qml文件中设置图像的源。qml文件在资源中,但源路径在资源之外,因此我将前缀设置为file://。当它尝试打开图像时,会发生此错误,但路径为true: qrc:/main窗口。qml:34:9:qml映像:无法打开:file:///home/me/Pictures/05.Jun.2017_00:23:57:149.jpg 我怎样才能修好它 使用资源文件结构显示代码或您可以先使用以下代码进行调试。首先尝试在QML中手动添加它,如果它工作正常,那么您可以检查是否从Q_属性访问

我已使用
Q_属性
在我的qml文件中设置
图像
。qml文件在资源中,但源路径在资源之外,因此我将前缀设置为
file://
。当它尝试打开图像时,会发生此错误,但路径为true:

qrc:/main窗口。qml:34:9:qml映像:无法打开:file:///home/me/Pictures/05.Jun.2017_00:23:57:149.jpg 我怎样才能修好它


使用资源文件结构显示代码您可以先使用以下代码进行调试。首先尝试在QML中手动添加它,如果它工作正常,那么您可以检查是否从Q_属性访问它。不要使用“文件://”


请出示你的密码
Image {
    anchors.fill: parent
    source: "qrc:/Images/Images/hello.png"
}