如何使gif文件在qt
中工作
我得到以下错误:
QML AnimatedImage: Error Reading Animated Image File qrc:/untitled/images/Pivot_Wave.gif
如果我运行下面的代码:
import QtQuick
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Rectangle {
width: parent.width
height: parent.height
color: 'green'
AnimatedImage {
id: animation
x: 100; y: 50
width: 200; height: 200
source: 'images/Pivot_Wave.gif'
}
}
}
这是gif本身:
qrc档案:
发布于 2022-05-09 05:55:41
好的,我不知道在我的项目中需要有一个Resource Collection File
来加载图像,而且Qt
也没有为我自动创建一个。
所以我自己创建了一个文件系统,然后右击文件系统中的Add New...
-> Qt
-> Qt Resource File
我从这个网站https://doc.qt.io/qt-5/resources.html中复制了这个例子,并将它应用到我的项目中:
<RCC>
<qresource prefix="/">
<file>images/Pivot_Wave.gif</file>
</qresource>
</RCC>
https://stackoverflow.com/questions/72152994
复制相似问题