在 Ubuntu Touch 的 QML 中使用图片作为图像对象

在 Ubuntu Touch 的 QML 中使用图片作为图像对象

我正在尝试将主图片目录 (/home/phablet/Pictures) 中的图像文件用于 AnimatedIMage/Image 对象,但它显示读取文件错误。我已经尝试了两种路径,但都没有用。我知道我可以简单地将图像包含在我的应用程序中,但我想随时使用不同的图像。谢谢。

    AnimatedImage{
        id: gifVegeta
        anchors.fill: parent
        source: '/home/phablet/Pictures/vegeta_charge.gif'
       //source: 'file:///home/phablet/Pictures/vegeta_charge.gif'
    }

答案1

恐怕你不能:你的应用程序受到限制,无法访问~/Pictures目录下的任何文件。有关此主题的更多信息,请访问https://developer.ubuntu.com/en/apps/platform/guides/app-confinement/

相关内容