简体   繁体   English

Qt Webkit:不允许加载本地资源

[英]Qt Webkit : Not allowed to load local resource

Greeting 欢迎

When i try to load picture from local drive i get the following error !!! 当我尝试从本地驱动器加载图片时,出现以下错误!

Not allowed to load local resource: file:///c:/qt/4.8.5/examples/webkit/imageanalyzer/resources/images/mtRainier.jpg

This is how i try to load image in HTML. 这就是我尝试以HTML加载图像的方式。

<img id="ImageObject" src="file:///c:/qt/4.8.5/examples/webkit/imageanalyzer/resources/images/mtRainier.jpg" alt="" width="304" height="228">

How can i fix this ? 我怎样才能解决这个问题 ?

Im using QT 4.8.5 , Qt Webkit And Visual Studio 2008 . 我正在使用QT 4.8.5Qt WebkitVisual Studio 2008

Thanks in Advance 提前致谢

I found the problem !!! 我发现了问题! JPEG was not supported in my qt. 我的qt不支持JPEG The error is totally irrelevant. 该错误是完全不相关的。 Add JPEG support to your project and you're good! 为您的项目添加JPEG支持,那就太好了!

PS: If you have same problem and you want to know this solution will help you or not, Try following code and see supported formats, If JPEG is not among them, Then you have same problem otherwise this solution wont work for you! PS:如果您遇到相同的问题,并且想知道该解决方案是否可以解决您的问题,请尝试以下代码并查看支持的格式,如果其中没有JPEG ,则您遇到了同样的问题,否则该解决方案将无法为您解决!

qDebug() << QImageWriter::supportedImageFormats();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM